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

Command fails after build. Database location error? #31

Closed
rpural opened this issue Dec 26, 2019 · 6 comments
Closed

Command fails after build. Database location error? #31

rpural opened this issue Dec 26, 2019 · 6 comments
Labels
bug Something isn't working question Further information is requested

Comments

@rpural
Copy link

rpural commented Dec 26, 2019

No matter what command or options I specify I get something like the following:

(base) rpn01@R5057499 ~ 0 $ osxphotos --db ~/Pictures/Photos\ Library.photoslibrary/ info
Traceback (most recent call last):
File "/Users/rpn01/anaconda3/bin/osxphotos", line 11, in
load_entry_point('osxphotos==0.17.8', 'console_scripts', 'osxphotos')()
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/click/decorators.py", line 27, in new_func
return f(get_current_context().obj, *args, **kwargs)
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/osxphotos-0.17.8-py3.7.egg/osxphotos/main.py", line 128, in info
File "/Users/rpn01/anaconda3/lib/python3.7/site-packages/yaml/init.py", line 200, in dump
return dump_all([data], stream, Dumper=Dumper, **kwds)
TypeError: dump_all() got an unexpected keyword argument 'sort_keys'
(base) rpn01@R5057499 ~ 0 $

I just cloned and built the program, so I'm not sure what I've done wrong...

@RhetTbull
Copy link
Owner

RhetTbull commented Dec 26, 2019

Edit: fixed PyYAML package name
Looks like the error is from yaml.dump() not finding sort_keys option — try this:
python3 -m pip install --upgrade PyYAML
Then try to re-run python3 setup.py install

Note: you should do this in a virtual env. Alternatively, use pipx to install (see the README.md)

@RhetTbull RhetTbull added the question Further information is requested label Dec 27, 2019
@RhetTbull
Copy link
Owner

Note: You might also try this:
conda update --all

then attempt to install again. If you still have problems, let me know.

@rpural
Copy link
Author

rpural commented Dec 27, 2019

I think that the root cause of the original problem was that the photo library was empty. The computer wasn't logged in to my iCloud account. I haven't gotten back to testing with a photo in the database, but this may be enough to locate where in the code to test the edge case of an empty library and stop the program more gracefully.

@RhetTbull
Copy link
Owner

Thanks -- I'll build a test case for empty library and see if I can replicate your error.

@RhetTbull
Copy link
Owner

I built a test case for empty database but was not able to replicate your error. In my test case, the empty database opens fine and returns 0 results as expected. See:

def test_count():
import osxphotos
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
photos = photosdb.photos()
assert len(photos) == 0

Your error looks like a PyYAML error related to sort_keys which was added to PyYAML in 5.1 (yaml/pyyaml#254). Try updating PyYAML and see if you still get the error.

@RhetTbull RhetTbull added the bug Something isn't working label Dec 29, 2019
@RhetTbull
Copy link
Owner

PyYAML >= 5.1.2 dependency added to setup.py and requirements.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants