-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copy error when adding files to an existing rocrate #86
Comments
Assuming this is the scenario:
from rocrate.rocrate import ROCrate
crate = ROCrate("/tmp/crate")
crate.add_file("/etc/fstab")
crate.write("/tmp/crate") $ rm -rf /tmp/crate && cp -rf test/test-data/read_crate /tmp/crate
$ python temp.py
Traceback (most recent call last):
File "temp.py", line 5, in <module>
crate.write("/tmp/crate")
File "/home/simleo/git/ro-crate-py/rocrate/rocrate.py", line 474, in write
self._copy_unlisted(self.source, base_path)
File "/home/simleo/git/ro-crate-py/rocrate/rocrate.py", line 468, in _copy_unlisted
shutil.copyfile(source, dest)
File "/usr/lib/python3.6/shutil.py", line 104, in copyfile
raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: PosixPath('/tmp/crate/ro-crate-metadata.jsonld') and PosixPath('/tmp/crate/ro-crate-metadata.jsonld') are the same file Note that adding the file is not required to trigger the error: just trying to write the crate back to the source dir is enough. |
I suggested a PR for this here: #88 |
Fixed in #88 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem: Trying to add a file to an existing ro-crate results into a copy-error that keeps the rocrate from being updated.
Use-Case: 2 scientists working together on a project and making the rocrate in multiple times. (re instantiating the same rocrate multiple times.)
Solution: An internal check if a file is already present in the rocrate folder and if already present ignore the copy
The text was updated successfully, but these errors were encountered: