os.path.expanduser on Windows: UnicodeEncodeError
Neil Hodgson
nyamatongwe+thunder at gmail.com
Tue Jul 19 00:48:10 EDT 2005
Bob Swerdlow wrote:
> My application is getting this error on Windows XP (works fine on Mac OS
> X) when it calls os.path.expanduser:
> UnicodeEncodeError: 'ascii' codec can't encode characters in position
> 52-56: ordinal not in range(128)
What does your environment look like? You can find out by typing
"SET" at a command prompt. The settings used are HOME, HOMEPATH and
HOMEDRIVE. Also helpful to print out the value being handed to
os.path.expanduser.
> I found referenes to Path 957650, but I'm not familiar with how such
> fixes are processed. Is there a patch I can add to fix this? How do I
> know what version of Python it is fixed in - that is, will upgrading to
> Python 2.3.5 fix this?
The patch is still "Status: Open" so hasn't been applied to a
release. It is not certain that this will fix your problem. The main
benefit of the patch appears to be IMO that it will use the standard
USERPROFILE environment variable.
Neil
More information about the Python-list
mailing list