[PyKDE] feature request for eric4
Andreas Pakulat
apaku at gmx.de
Sat Jul 8 13:01:19 BST 2006
On 08.07.06 13:49:00, Hans-Peter Jansen wrote:
> Am Samstag, 8. Juli 2006 13:00 schrieb Andreas Pakulat:
> > The other thing is: Running my application inside eric3 (debug or
> > direct run) doesn't trigger the error, even if I launch eric3 via:
> > LANG=de_DE eric3. When I run the app from the commandline using
> > LANG=de_DE python myapp.py I get the exception. Any idea what might
> > be different here? I don't really want to debug that using the python
> > debugg...
>
> Sounds like it's i/o encoding related, and then yes, that could make a
> difference inside eric. If I remember correctly, eric sets a different
> default encoding compared to plain python.
> (see site-packages/sitecustomize.py)
I'm fetching a website, feeding it to lxml and then accessing parts of
the tree via xpath. The resulting nodes will be put into a Qt4 model and
then converted to a QString. After the data is in lxml I only use
unicode strings for it (i.e. lxml returns elements with unicode strings
as text/attribute values)..
> How about posting the traceback, and let's see, what can be done (even
> if it's slightly off topic ;)
I don't think you'll find something, but here it is:
Traceback (most recent call last):
File "/home/andreas/projects/pyfilmdbsimpleui/pyfilmdbsimpleui/widgets/addversionsdialog.py", line 38, in on_availableVersions_currentItemChanged
self.versionData[url] = self.plugin.getVersionInfo(url,releaseCountry)
File "/home/andreas/projects/pyfilmdbsimpleui/pyfilmdbsimpleui/plugins/ofdb_de.py", line 138, in getVersionInfo
self.parseSubtitles(elem, html)
File "/home/andreas/projects/pyfilmdbsimpleui/pyfilmdbsimpleui/plugins/ofdb_de.py", line 196, in parseSubtitles
lang = txt[0:endindex].strip().decode('utf-8')
File "/home/andreas/python2.4/lib/python2.4/encodings/utf_8.py", line 16, in decode
return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1: ordinal not in range(128)
The website parsed is:
http://www.ofdb.de/view.php?page=fassung&fid=6&vid=135646
the problem are the subtitles, which contain non-ascii characters. I can
parse other web pages from that site containing german umlauts in the
subtitle list. I'm now going to the beach ;-), but I'll look into that later
tonight, eventually via python debugger.
Andreas
--
If you stand on your head, you will get footprints in your hair.
More information about the PyQt
mailing list