X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5f41a89121dea9d536ea33391ae2827432db947b..c68e4ba51336a871dff26ae9f8dc7eb7e316083d:/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