os.path.expanduser on Windows: UnicodeEncodeError

Discussion in 'Python' started by Bob Swerdlow, Jul 18, 2005.

  1. Bob Swerdlow

    Bob Swerdlow Guest

    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)

    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
    Bob Swerdlow, Jul 18, 2005
    #1
    1. Advertising

  2. Bob Swerdlow

    Neil Hodgson Guest

    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
    Neil Hodgson, Jul 19, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony Nelson
    Replies:
    4
    Views:
    359
    Tony Nelson
    Nov 18, 2005
  2. Kevin F

    where is os.path.expanduser?

    Kevin F, Mar 23, 2006, in forum: Python
    Replies:
    2
    Views:
    682
    Kevin F
    Mar 23, 2006
  3. Kevin F
    Replies:
    0
    Views:
    286
    Kevin F
    Mar 23, 2006
  4. Edward Diener
    Replies:
    5
    Views:
    1,116
    Edward Diener
    Jul 8, 2007
  5. geoff_ness

    UnicodeEncodeError in Windows

    geoff_ness, Sep 17, 2007, in forum: Python
    Replies:
    2
    Views:
    576
    geoff_ness
    Sep 18, 2007
Loading...

Share This Page