Skip to content

Unable to copy dir from osfs to memory fs #2

@GoogleCodeExporter

Description

@GoogleCodeExporter
I have a directory with some files called Maps which I would like to copy
into a memoryfs. I am using utils.copydir. If I create a directory called
maps first in the memfs I get a destination exist error. If I don't, I get
a resource not found error.

Here is the code:
filesys = fs.memoryfs.MemoryFS()
programFS = fs.osfs.OSFS(".")
#filesys.makedir("Maps")
fs.utils.copydir((programFS, "Maps"), (filesys, "Maps"))

With line uncommented:
...
File "/usr/local/lib/python2.6/dist-packages/fs/utils.py", line 131, in copydir
    mount_fs.copydir('dir1', 'dir2', ignore_errors=ignore_errors,
chunk_size=chunk_size)
  File "/usr/local/lib/python2.6/dist-packages/fs/base.py", line 664, in
copydir
    self.makedir(dst, allow_recreate=overwrite)
  File "/usr/local/lib/python2.6/dist-packages/fs/base.py", line 112, in
acquire_lock
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/fs/mountfs.py", line 129, in
makedir
    return fs.makedir(delegate_path, recursive=recursive,
allow_recreate=allow_recreate)
  File "/usr/local/lib/python2.6/dist-packages/fs/base.py", line 764, in
makedir
    return self.parent.makedir(self._delegate(path), recursive=recursive,
allow_recreate=allow_recreate)
  File "/usr/local/lib/python2.6/dist-packages/fs/base.py", line 112, in
acquire_lock
    return func(self, *args, **kwargs)
  File "/usr/local/lib/python2.6/dist-packages/fs/memoryfs.py", line 274,
in makedir
    raise DestinationExistsError(dirname)
fs.errors.DestinationExistsError: Destination exists: Maps


And with commented:
File "/usr/local/lib/python2.6/dist-packages/fs/utils.py", line 126, in copydir
    fs2 = fs2.opendir(dir2)
  File "/usr/local/lib/python2.6/dist-packages/fs/base.py", line 422, in
opendir
    raise ResourceNotFoundError(path)
fs.errors.ResourceNotFoundError: Resource not found: Maps

Original issue reported on code.google.com by cro...@gmail.com on 22 Oct 2009 at 9:19

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions