X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/74fec3cd8284eae4829dad2c287588d52c621c4b..refs/heads/20750-sharing-token-scopes:/doc/sdk/python/cookbook.html.textile.liquid diff --git a/doc/sdk/python/cookbook.html.textile.liquid b/doc/sdk/python/cookbook.html.textile.liquid index f2d087625e..c9e1f05f17 100644 --- a/doc/sdk/python/cookbook.html.textile.liquid +++ b/doc/sdk/python/cookbook.html.textile.liquid @@ -471,17 +471,16 @@ import collections import pathlib root_collection = arvados.collection.Collection(...) # Start work from the base stream. -stream_queue = collections.deque(['.']) +stream_queue = collections.deque([pathlib.PurePosixPath('.')]) while stream_queue: - stream_name = stream_queue.popleft() - collection = root_collection.find(stream_name) + stream_path = stream_queue.popleft() + collection = root_collection.find(str(stream_path)) for item_name in collection: try: my_file = collection.open(item_name) except IsADirectoryError: # item_name refers to a stream. Queue it to walk later. - stream_path = pathlib.Path(stream_name, item_name) - stream_queue.append(stream_path.as_posix()) + stream_queue.append(stream_path / item_name) continue with my_file: ... # Work with my_file as desired