Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Uploading without creating sets [OS X] #37

Open
madswesti opened this issue Oct 17, 2014 · 4 comments
Open

Uploading without creating sets [OS X] #37

madswesti opened this issue Oct 17, 2014 · 4 comments

Comments

@madswesti
Copy link

The upload runs perfectly, but when it tries to create a set, I get the following stack trace:

Traceback (most recent call last):
File "./folders2flickr", line 8, in
f2flickr.uploadr.main()
File "/Users/username/folders2flickr/f2flickr/uploadr.py", line 628, in main
tags2set.createSets(uploadedNow, HISTORY_FILE)
File "/Users/username/folders2flickr/f2flickr/tags2set.py", line 88, in createSets
uploaded = shelve.open( historyFile )
File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 239, in open
return DbfilenameShelf(filename, flag, protocol, writeback)
File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shelve.py", line 223, in init
Shelf.init(self, anydbm.open(filename, flag), protocol, writeback)
File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/anydbm.py", line 85, in open
return mod.open(file, flag, mode)
gdbm.error: (35, 'Resource temporarily unavailable')

The debug.log says:
2014-10-18 01:10:04,118 DEBUG successful.
2014-10-18 01:10:04,121 DEBUG tags2set: Started tags2set

EDIT
I'm just realising that it may not be completely apparent for everybody. I'm on OS X Yosemite with python .7.8 installed via Homebrew.

@richq
Copy link
Owner

richq commented Oct 27, 2014

Hmm, looks like it can't write the shelve file. maybe there are some differences in the semantics if it's already opened on Mac? The stack trace looks promising, I'll take a look.

@ghost
Copy link

ghost commented Jan 16, 2015

I can confirm this issue on Yosemite with the same python version (2.7.8_2 installed via homebrew), and with exactly the same stacktrace as in the original post by @madswesti.

Not sure if this has any relation to the root cause, but the tag that the script is generating contains hashes and forward slashes, i.e. #/Downloaded#Albums/100069383912684544889/Barcelona#13. Also further up in the log I see exceptions.UnicodeEncodeError, but those don't seem to be fatal.

Update: apparently it is a known issue on OSX: urllib3/urllib3#63 - that ticket contains a dirty workaround.

What I ended up doing was an even dirtier return in tags2sets.py:line 92:

try:
    uploaded = shelve.open( historyFile )
except Exception, e:
    print e
    print "Aborting createSets()..."
    return

@madswesti
Copy link
Author

I don't think the hashes and forward slashes are the issue. I'm currently running the script on my Linux server and everything works with no issues and images are tagged as "#path/to/file/filename.JPG". I think it's related to gdbm, but thats just a hunch.

@madswesti madswesti changed the title Uploading without creating sets Uploading without creating sets [OS X] Jan 17, 2015
@madswesti
Copy link
Author

@richq: I think I may have solved it. By adding "self.uploaded.close()" at the end of the "upload" function in uploadr.py. Both sets and tags seems to work.

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

No branches or pull requests

2 participants