GjjvdBurg / HugoPhotoSwipe

Command-line tool for easy PhotoSwipe galleries in Hugo
https://gertjanvandenburg.com/blog/hugophotoswipe/
GNU General Public License v3.0
128 stars 15 forks source link

AttributeError: 'NoneType' object has no attribute 'items' #2

Closed iammatthias closed 7 years ago

iammatthias commented 7 years ago

Thanks for the help with #1, and thank you for building this script!

I am now able to run hps init and hps new. I have configured my YAML file to point to my Hugo site directory:

---
album_file: album.yml
cover_filename: coverimage.jpg
dim_coverimage: 600
dim_max_large: 1600
dim_max_small: 800
dim_thumbnail: 256
dirname_large: large
dirname_small: small
dirname_thumb: thumb
markdown_dir: /Users/iammatthias/Sites/Hugo/com/content/gal
output_dir: /Users/iammatthias/Sites/Hugo/com/src/images
output_format: jpg
photo_dir: photos
smartcrop_js_path:
url_prefix:
use_smartcrop_js: False

and now I'm getting this issue when I run hps update:

Traceback (most recent call last):
  File "/usr/local/bin/hps", line 12, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/ui.py", line 23, in main
    hps.update(name=album)
  File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/hugophotoswipe.py", line 58, in update
    album.update()
  File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/album.py", line 252, in update
    self.create_markdown()
  File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/album.py", line 115, in create_markdown
    proptxt = ["%s = \"%s\"" % (k, v) for k, v in self.properties.items()]
AttributeError: 'NoneType' object has no attribute 'items'

I get the same error when I try to run the scrip with Python 3:

Traceback (most recent call last):
  File "/usr/local/bin/hps", line 12, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/ui.py", line 23, in main
    hps.update(name=album)
  File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/hugophotoswipe.py", line 58, in update
    album.update()
  File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/album.py", line 252, in update
    self.create_markdown()
  File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/album.py", line 115, in create_markdown
    proptxt = ["%s = \"%s\"" % (k, v) for k, v in self.properties.items()]
AttributeError: 'NoneType' object has no attribute 'items'
GjjvdBurg commented 7 years ago

Ah, this is a little oversight on my part. You need a properties: line in the YAML of the album. I'll fix this bug as soon as possible to but for now adding that should fix it.

On 25 Dec 2016 18:46, "Matthias Jordan" notifications@github.com wrote:

Thanks for the help with #1 https://github.com/GjjvdBurg/HugoPhotoSwipe/issues/1, and thank you for building this script!

I am now able to run hps init and hps new. I have configured my YAML file to point to my Hugo site directory:


album_file: album.yml cover_filename: coverimage.jpg dim_coverimage: 600 dim_max_large: 1600 dim_max_small: 800 dim_thumbnail: 256 dirname_large: large dirname_small: small dirname_thumb: thumb markdown_dir: /Users/iammatthias/Sites/Hugo/com/content/gal output_dir: /Users/iammatthias/Sites/Hugo/com/src/images output_format: jpg photo_dir: photos smartcrop_js_path: url_prefix: use_smartcrop_js: False

and now I'm getting this issue when I run hps update:

Traceback (most recent call last): File "/usr/local/bin/hps", line 12, in sys.exit(main()) File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/ui.py", line 23, in main hps.update(name=album) File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/hugophotoswipe.py", line 58, in update album.update() File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/album.py", line 252, in update self.create_markdown() File "/usr/local/lib/python2.7/site-packages/hugophotoswipe/album.py", line 115, in create_markdown proptxt = ["%s = \"%s\"" % (k, v) for k, v in self.properties.items()] AttributeError: 'NoneType' object has no attribute 'items'

I get the same error when I try to run the scrip with Python 3:

Traceback (most recent call last): File "/usr/local/bin/hps", line 12, in sys.exit(main()) File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/ui.py", line 23, in main hps.update(name=album) File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/hugophotoswipe.py", line 58, in update album.update() File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/album.py", line 252, in update self.create_markdown() File "/usr/local/lib/python3.6/site-packages/hugophotoswipe/album.py", line 115, in create_markdown proptxt = ["%s = \"%s\"" % (k, v) for k, v in self.properties.items()] AttributeError: 'NoneType' object has no attribute 'items'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GjjvdBurg/HugoPhotoSwipe/issues/2, or mute the thread https://github.com/notifications/unsubscribe-auth/ADImqAML8tEEHFeZ5HjVYR22gGpdLBD2ks5rLqvngaJpZM4LVcb_ .

GjjvdBurg commented 7 years ago

@iammatthias I've updated the code, should be fixed now. Thanks for your thorough testing, and let me know if you run into any other problems.