photo / import

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

UnicodeEncodeError: 'ascii' codec can't encode character #4

Open d6y opened 12 years ago

d6y commented 12 years ago

Hello! Thanks for this tool. I just tried it and encountered a few problems. The 500 errors are a bit of an issue, but the last one gave a message I thought might be useful.... (keys and secrets omitted).

openphoto-import (master)$ python import.py --host=d6y.openphoto.me --consumer-key=xx --consumer-secret=xx --token=xx --token-secret=xx
Found a total of 1577 files to process
Processing 1 of 1577 1010505223.json ... FAILED: 500 - An unknown error occurred.
Processing 2 of 1577 1010506241.json ... FAILED: 500 - An unknown error occurred.
Processing 3 of 1577 1011363856.json ... FAILED: 500 - An unknown error occurred.
Processing 4 of 1577 1011364722.json ... FAILED: 500 - An unknown error occurred.
Processing 5 of 1577 1058682439.json ... FAILED: 500 - An unknown error occurred.
Processing 6 of 1577 1059547820.json ... FAILED: 500 - An unknown error occurred.
Processing 7 of 1577 1059549012.json ... FAILED: 500 - An unknown error occurred.
Processing 8 of 1577 1059550908.json ...
Traceback (most recent call last):
  File "import.py", line 79, in <module>
    import_into_openphoto(client)
  File "import.py", line 37, in import_into_openphoto
    resp = client.post('/photo/upload.json', params)
  File "/Library/Python/2.7/site-packages/openphoto-0.1-py2.7.egg/openphoto/__init__.py", line 41, in post
    body = urllib.urlencode(params)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib.py", line 1294, in urlencode
    v = quote_plus(str(v))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf4' in position 1: ordinal not in range(128)

openphoto-import (master)$ more fetched/1059550908.json 
{"description": "H\u00f4tel Colbert, I think.  \n<a href=\"http://en.wikipedia.org/wiki/Saint-Omer\">en.wikipedia.org/wiki/Saint-Omer</a>", "license": "", "title": "Saint Omer", "dateUploaded": "1186648402", "photo": "http://farm2.staticflickr.com/1395/1059550908_ef47d97191_o.jpg", "permission": "1", "longitude": "2.253087", "dateTaken": "1186648402", "latitude": "50.749005", "id": "1059550908", "tags": "flickr:place_id=Mw_SImRQULzqjJpumA"}

Here's an example of one of the 500:

 {"license": "", "tags": "", "dateUploaded": "1186265418", "photo": "http://farm2.staticflickr.com/1134/1010505223_e994225f4a_o.jpg", "title": "an end to slow cheese", "dateTaken": "1186265418", "permission": "1", "id": "1010505223"}
jmathai commented 12 years ago

This is an issue being tracked here openphoto/openphoto-python#7. Will keep this open as a tracking issue.

sneakypete81 commented 11 years ago

@d6y: can you please confirm that this is working now?

The openphoto-python library has been renamed to "trovebox", so you'll need to install this first:

   sudo pip install trovebox

See the updated readme for more details.

d6y commented 11 years ago

Bare with me: I'll need to set up a new account and try out an import. May take a few days. (The importer in Trovebox imported my Flickr photos without problem some time ago).