openphoto/import — Issue #4: UnicodeEncodeError: 'ascii' codec can't encode character 
Author: d6y
Created: 2012-02-05 17:55:47+00:00
State: open

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
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. \nen.wikipedia.org/wiki/Saint-Omer", "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"}