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 #20

Closed sushicodeur closed 11 years ago

sushicodeur commented 11 years ago

Hello, I'm trying to import my flickr photo using this script and I'm facing the following error :

    Found a total of 48 files to process
    Processing 1 of 48 20090228T140409-3316349518.json ...
    Traceback (most recent call last):
      File "./import.py", line 91, in <module>
        import_into_openphoto(client)
      File "./import.py", line 42, in import_into_openphoto
        resp = client.post('/photo/upload.json', params)
      File "/home/sushi/pymod/openphoto-python/openphoto/openphoto_http.py", line 125, in post
        return self._process_response(response, content)
      File "/home/sushi/pymod/openphoto-python/openphoto/openphoto_http.py", line 178, in _process_response
        json_response = json.loads(content)
      File "/usr/languages/python/2.6/lib/python2.6/json/__init__.py", line 307, in loads
        return _default_decoder.decode(s)
      File "/usr/languages/python/2.6/lib/python2.6/json/decoder.py", line 319, in decode
        obj, end = self.raw_decode(s, idx=_w(s, 0).end())
      File "/usr/languages/python/2.6/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

The JSON comes from the flickr export script.

Do you have any idea ?

sushicodeur commented 11 years ago

Ok, it looks like in "/home/sushi/pymod/openphoto-python/openphoto/openphoto_http.py", line 178, the response is :

{'status': '200', 'transfer-encoding': 'chunked', 'set-cookie': 'PHPSESSID=hf6pgjfk6sbilcfku38nlihsjnfpldgh; path=/', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'server': 'Apache/2.2', 'pragma': 'no-cache', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'date': 'Wed, 01 May 2013 13:31:53 GMT', 'content-type': 'application/json'}

and the content is

{"message":"Invalid mime type","code":500,"result":false}

Getting closer... any idea ?

sushicodeur commented 11 years ago

Ok, looks like it's a problem with writing temporary files

<b>Warning</b>:  file_put_contents(/tmp/openphoto-cache/oauthTimestamps) [<a href='function.file-put-contents'>function.file-put-contents</a>]: failed to open stream: Permission denied in <b>/home/sushi/sites/mysite.com/openphoto/src/libraries/external/epi/EpiCache_File.php</b> on line <b>57</b><br />
{"message":"Invalid mime type","code":500,"result":false}
jmathai commented 11 years ago

You've got a couple options. I'd suggest using APC instead of the file cache. You can do this by creating a file named src/configs/override.ini with the following contents in your OpenPhoto installation.

[epi]
cache=EpiCache_Apc