photo / import

Import tool companion for all of the export tools
http://theopenphotoproject.org
Apache License 2.0
16 stars 11 forks source link

ValueError: No JSON object could be decoded #14

Closed madranet closed 12 years ago

madranet commented 12 years ago

I'm running OSX Lion, with Python 2,7,2 installed using Homebrew. I get the above error when I run the import script. It borks on each one with ValueError: No JSON object could be decoded and then moves that .json file into the 'errored' folder.

Could really do with getting this import done ASAP, as my Flickr Pro account runs out in 3 days time and I don't want to have to fork out for a renewal. Here's the full terminal output, leading to the error:

Found a total of 3444 files to process
Processing 1 of 3444 20070515T130531-499365892.json ...
Traceback (most recent call last):
  File "import.py", line 91, in <module>
    import_into_openphoto(client)
  File "import.py", line 43, in import_into_openphoto
    result = json.loads(resp)
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 326, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
madranet commented 12 years ago

Just tried running the import script on my Debian VPS and got pretty much the same error:

Found a total of 3453 files to process
Processing 1 of 3453 20070515T130442-499413893.json ...
Traceback (most recent call last):
  File "import.py", line 91, in <module>
    import_into_openphoto(client)
  File "import.py", line 43, in import_into_openphoto
    result = json.loads(resp)
  File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.6/json/decoder.py", line 338, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

In spite of what searching the intarwebs tells me, I can't believe I'm the only person in the known universe running into this, since I've had exactly the same problem running on two completely different platforms!

madranet commented 12 years ago

Accch! –what an eejit!

I've just realised my problems were entirely down to user error. When adapting the python command:

python import.py --host=username.openphoto.me --consumer-key=****** --consumer-secret=****** --token=****** --token-secret=******

...I'd been so busy making sure I'd filled in all my various keys, secrets and tokens etc. that I'd not noticed I'd overlooked changing the --host=username.openphoto.me part at the start of the line. All chugging along nicely now, although it looks like the import might take quite a while, at the rate it's going.

Anyway, hopefully this might help anyone else suffering from terminal idiocy, like me!