Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > os.path.expanduser on Windows: UnicodeEncodeError

Reply
Thread Tools

os.path.expanduser on Windows: UnicodeEncodeError

 
 
Bob Swerdlow
Guest
Posts: n/a
 
      07-18-2005
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(12

The code was built with Python 2.3.4.

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?

Thanks for your help,

Bob Swerdlow
VP Engineering
Goombah - Music Discovery
http://www.velocityreviews.com/forums/(E-Mail Removed)


 
Reply With Quote
 
 
 
 
Neil Hodgson
Guest
Posts: n/a
 
      07-19-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(12


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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
UnicodeEncodeError while reading xml file (newbie question) nikosk Python 2 06-08-2008 11:16 AM
UnicodeEncodeError in Windows geoff_ness Python 2 09-18-2007 10:03 AM
UnicodeEncodeError - a bit out of my element... erikcw Python 3 04-11-2007 05:46 PM
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 99: ordinal not in range(128) Francach Python 2 11-06-2005 09:05 PM
UnicodeEncodeError in string conversion Maurice LING Python 1 03-31-2005 09:00 AM



Advertisments