[Spambayes] "UnicodeDecodeError" in Czech setup - first
experiments, post-Python-baby-steps results
Mark Hammond
mhammond at skippinet.com.au
Tue Jul 8 13:04:51 EDT 2003
Erik:
>
> [1]:
> >>> import os
> >>> f=unicode("c:\\@test-\xe0\xf2", "latin-1")
> >>> os.path.join(f, "foo")
> u'c:\\@test-\xe0\xf2\\foo'
>
> [2]:
> >>> str(os.path.join(f, "foo"))
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in -toplevel-
> str(os.path.join(f, "foo"))
> UnicodeEncodeError: 'ascii' codec can't encode characters in
> position 9-10:
> ordinal not in range(128)
So this is exactly what I saw :( Can you please try the following:
>>> from win32com.shell import shell, shellcon
>>> d=shell.SHGetFolderPath(0,shellcon.CSIDL_APPDATA,0,0)
>>> import os
>>> f=os.path.join(d, "SpamBayes")
>>> f
u'E:\\Documents and Settings\\skip\\Application Data\\SpamBayes'
I expect you will get similar results to me - except that will stump me, as
it will not help explain why you are seeing the failuer in the binary :(
Our next step would be to use this Python version to run from source-code,
and see if we get the error there. I am starting to suspect something in
the "installer" package I used to create the binary.
> Tried importing ntpath and testing it too, since there was mention of
it...
That was misleading on my part, and just a side-effect of the way I was
testing. os.path *is* ntpath (on Windows) so you almost never will see
ntpath used directly.
Mark.
More information about the Spambayes
mailing list