Python 3.4.2
i'm using the Client interface for Scrapinghub API, which can be found here:
https://github.com/scrapinghub/python-scrapinghub
I Scrape a site and want get and print the items with
for item in job.items():
print(item)
In a python interpreter this works fine but when i export my code in a script (f.e. 'test.py' and run it with 'python3 test.py' an error occures, which says:
Traceback (most recent call last):
File "test.py", line 24, in <module>
print(insert_statement)
UnicodeEncodeError: 'ascii' codec can't encode character '\xdf' in position 247: ordinal not in range(128)
The text of line 24 is sth like this : [ ... ] Tobias Weiß [...]
I already run 'dpkg-reconfigure locales' and set it to 'de_DE.UTF-8 UTF-8' but it does not seems to be the problem.
Do i have to convert the item dict to utf8 for every result or is there another solution i don't see.
from scrapinghub import Connection
conn = Connection('1234567890')
project = conn[123456]
jobs = project.jobs(state='finished')
for job in jobs:
if "consumed" not in job.info['tags']:
for item in job.items():
print(item)
Regards