Skip to content
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

Installing via pip does not set the execution bit correctly. #5

Open
jerroydmoore opened this issue May 18, 2015 · 1 comment
Open

Comments

@jerroydmoore
Copy link

After installing pybagit via pip, I get the following error

12:08:20 pybagittest$  ./run.py
Traceback (most recent call last):
  File "./run.py", line 6, in <module>
    bag.update()
  File "/Library/Python/2.7/site-packages/pybagit/bagit.py", line 262, in update
    p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 709, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1326, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

After flipping the execute bit ON for multichecksum.pyc and multichecksum.py, it is able to proceed, but fails with the following:

12:11:25 pybagittest$  ./run.py
/Users/jnmoore/Develop/pybagittest/mycontents/data
Traceback (most recent call last):
  File "./run.py", line 7, in <module>
    bag.update()
  File "/Library/Python/2.7/site-packages/pybagit/bagit.py", line 274, in update
    csum = self._calculate_checksum(os.path.join(self.bag_directory, f))
  File "/Library/Python/2.7/site-packages/pybagit/bagit.py", line 411, in _calculate_checksum
    fd = open(filepath, 'rb')
IOError: [Errno 2] No such file or directory: '/Users/jnmoore/Develop/pybagittest/mycontents/bagit.txt'

I'm not sure how to initiate a new bag after reading the docs. It looks like it could work with existing bags, but I haven't tried it.

Additionally, is there a way to customize the data directory? I don't want all my contents living in /mycontents/data. I would like to leave my contents undisturbed as other processes require it. I would however, like a manifest file to live at mycontents/file.manifest.

Additionally, here is my PoC:

#!/usr/bin/env python
import pybagit.bagit as b

bag = b.BagIt("mycontents/")
print bag.get_data_directory()
bag.update()
@ahankinson
Copy link
Owner

Thanks Jerry.

The execute bit is set on multichecksum.py on my version of the repo, so I'm surprised that it was unset on yours. Any more info you can give me would help track it down.

The data directory is a requirement under the IETF draft of the specs, so not keeping your data in data would not conform to the specs. See: https://tools.ietf.org/html/draft-kunze-bagit-10#section-2.1.2

Additionally, the manifest file must live at manifest-<alg>.txt, where alg is one of SHA1 or MD5. This is also part of the spec: https://tools.ietf.org/html/draft-kunze-bagit-10#section-2.1.3

Initiating a new bag is pretty easy. You can see how to do it in the examples/newbag.py file.

Let me know if I can be any more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants