[tahoe-lafs-trac-stream] [Tahoe-LAFS] #1674: os.path.expanduser (and therefore abspath_expanduser_unicode) fails on Windows if username or home directory contains non-ASCII characters (was: abspath_expanduser_unicode fails on Windows if username or home directory contains non-ASCII characters)

Tahoe-LAFS trac at tahoe-lafs.org
Thu Aug 21 09:30:22 UTC 2014


#1674: os.path.expanduser (and therefore abspath_expanduser_unicode) fails on
Windows if username or home directory contains non-ASCII characters
-------------------------+-----------------------------
     Reporter:  vikarti  |      Owner:  daira
         Type:  defect   |     Status:  new
     Priority:  major    |  Milestone:  soon
    Component:  code     |    Version:  1.9.1
   Resolution:           |   Keywords:  windows unicode
Launchpad Bug:           |
-------------------------+-----------------------------
Changes (by daira):

 * owner:  davidsarah => daira
 * status:  assigned => new


Old description:

> attempt to perform setup.py test results in
> {{{
> argparse 0.9.1 is already the active version in easy-install.pth
> 16:34
>
> Using c:\tahoe\allmydata-tahoe-1.9.1\support\lib\site-
> packages\argparse-0.9.1-py2.7-win32.egg
> Searching for zbase32==1.1.3
> Best match: zbase32 1.1.3
> Processing zbase32-1.1.3-py2.7.egg
> zbase32 1.1.3 is already the active version in easy-install.pth
>
> Using c:\tahoe\allmydata-tahoe-1.9.1\support\lib\site-
> packages\zbase32-1.1.3-py2.7.egg
> Finished processing dependencies for allmydata-tahoe==1.9.1
>
> Setting up environment to run scripts for the current user...
> Already done: associate the filetype .pyscript with Python.File for the
> current user.
> Already done: add .pyscript to the user environment variable PATHEXT.
> Already done: add .pyw to the user environment variable PATHEXT.
> running make_executable
> running build
> running build_py
>
> Setting up environment to run scripts for the current user...
> Already done: associate the filetype .pyscript with Python.File for the
> current user.
> Already done: add .pyscript to the user environment variable PATHEXT.
> Already done: add .pyw to the user environment variable PATHEXT.
> running trial
> Traceback (most recent call last):
>   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Scripts\tahoe.pyscript",
> line 16, in <module>
>     load_entry_point('allmydata-tahoe==1.9.1', 'console_scripts',
> 'tahoe')()
>   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
> packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 318, in
> load_entry_point
>     return get_distribution(dist).load_entry_point(group, name)
>   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
> packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 2245, in
> load_entry_point
>     return ep.load()
>   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
> packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 1978, in load
>     entry = __import__(self.module_name, globals(),globals(),
> ['__name__'])
>   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\scripts\runner.py",
> line 7, in <module>
>     from allmydata.scripts.common import BaseOptions
>   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\scripts\common.py",
> line 19, in <module>
>     path = abspath_expanduser_unicode(u"~/.tahoe")
>   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\util\fileutil.py",
> line 291, in abspath_expanduser_unicode
>     path = os.path.expanduser(path)
>   File "C:\Python27\lib\ntpath.py", line 301, in expanduser
>     return userhome + path[i:]
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9:
> ordinal not in range(128)
>
> C:\Tahoe\allmydata-tahoe-1.9.1>
> ^
> }}}
> Host:Windows 7,Python 2.7(same issue - with 2.6.6)
> This problem happens if current username is not ASCII (it is by default
> on some international localizations of Windows
> is this bug with python on windows?

New description:

 attempt to perform setup.py test results in
 {{{
 argparse 0.9.1 is already the active version in easy-install.pth
 16:34

 Using c:\tahoe\allmydata-tahoe-1.9.1\support\lib\site-
 packages\argparse-0.9.1-py2.7-win32.egg
 Searching for zbase32==1.1.3
 Best match: zbase32 1.1.3
 Processing zbase32-1.1.3-py2.7.egg
 zbase32 1.1.3 is already the active version in easy-install.pth

 Using c:\tahoe\allmydata-tahoe-1.9.1\support\lib\site-
 packages\zbase32-1.1.3-py2.7.egg
 Finished processing dependencies for allmydata-tahoe==1.9.1

 Setting up environment to run scripts for the current user...
 Already done: associate the filetype .pyscript with Python.File for the
 current user.
 Already done: add .pyscript to the user environment variable PATHEXT.
 Already done: add .pyw to the user environment variable PATHEXT.
 running make_executable
 running build
 running build_py

 Setting up environment to run scripts for the current user...
 Already done: associate the filetype .pyscript with Python.File for the
 current user.
 Already done: add .pyscript to the user environment variable PATHEXT.
 Already done: add .pyw to the user environment variable PATHEXT.
 running trial
 Traceback (most recent call last):
   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Scripts\tahoe.pyscript",
 line 16, in <module>
     load_entry_point('allmydata-tahoe==1.9.1', 'console_scripts',
 'tahoe')()
   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
 packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 318, in
 load_entry_point
     return get_distribution(dist).load_entry_point(group, name)
   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
 packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 2245, in
 load_entry_point
     return ep.load()
   File "C:\Tahoe\allmydata-tahoe-1.9.1\support\Lib\site-
 packages\setuptools-0.6c16dev3.egg\pkg_resources.py", line 1978, in load
     entry = __import__(self.module_name, globals(),globals(),
 ['__name__'])
   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\scripts\runner.py",
 line 7, in <module>
     from allmydata.scripts.common import BaseOptions
   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\scripts\common.py",
 line 19, in <module>
     path = abspath_expanduser_unicode(u"~/.tahoe")
   File "c:\tahoe\allmydata-tahoe-1.9.1\src\allmydata\util\fileutil.py",
 line 291, in abspath_expanduser_unicode
     path = os.path.expanduser(path)
   File "C:\Python27\lib\ntpath.py", line 301, in expanduser
     return userhome + path[i:]
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xc0 in position 9:
 ordinal not in range(128)

 C:\Tahoe\allmydata-tahoe-1.9.1>
 ^
 }}}
 Host:Windows 7,Python 2.7(same issue - with 2.6.6)
 This problem happens if current username is not ASCII (it is by default on
 some international localizations of Windows
 is this bug with python on windows?

--

Comment:

 See also #2235: by making all user-expansions go through
 `fileutil.abspath_expanduser_unicode`, we'll only need to fix this problem
 in that function.

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/1674#comment:5>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list