Unicode string in namespace_package name causes TypeError in site.py with single-version-externally-managed

Issue #272 resolved
Jason R. Coombs
created an issue

It seems that including a unicode string in namespace_package name causes TypeError in site.py with single-version-externally-managed

Originally reported as [[https://github.com/pypa/pip/issues/449|this PIP issue]], it seems the underlying issue is with setuptools and the {{{--single-version-externally-managed}}} option.

When one installs a package with a namespace_package that is unicode (even though it is ASCII), it creates a .pth file that causes the environment to fail to start.

For example,

{{{
jaraco@hideaki:~$ virtualenv --distribute env
New python executable in env/bin/python2.7
Also creating executable in env/bin/python
Installing distribute.............................................................................................................................................................................................done.
Installing pip...............done.
jaraco@hideaki:~$ wget http://pypi.python.org/packages/source/j/jaraco.util/jaraco.util-5.0.1.tar.gz -O - | tar xz
--2012-02-07 02:53:39-- http://pypi.python.org/packages/source/j/jaraco.util/jaraco.util-5.0.1.tar.gz
Resolving pypi.python.org... 82.94.164.168, 2001:888:2000:d::a8
Connecting to pypi.python.org|82.94.164.168|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 60069 (59K) [application/octet-stream]
Saving to: `STDOUT'

100%[======================================>] 60,069 141K/s in 0.4s

2012-02-07 02:53:39 (141 KB/s) - written to stdout [60069/60069]

jaraco@hideaki:~$ cd jaraco.util-5.0.1
jaraco@hideaki:~/jaraco.util-5.0.1$ ../env/bin/python setup.py install --single-version-externally-managed --record foo
running install
running build
running build_py
...
running install_lib
...
running install_egg_info
running egg_info
...
Installing /home/jaraco/env/lib/python2.7/site-packages/jaraco.util-5.0.1-py2.7-nspkg.pth
running install_scripts
Installing roll-dice script to /home/jaraco/env/bin
Installing calc-prorate script to /home/jaraco/env/bin
writing list of installed files to 'foo'
jaraco@hideaki:~/jaraco.util-5.0.1$ ../env/bin/python
Traceback (most recent call last):
File "/home/jaraco/jaraco.util-5.0.1/../env/lib/python2.7/site.py", line 677, in <module>
main()
File "/home/jaraco/jaraco.util-5.0.1/../env/lib/python2.7/site.py", line 657, in main
paths_in_sys = addsitepackages(paths_in_sys)
File "/home/jaraco/jaraco.util-5.0.1/../env/lib/python2.7/site.py", line 273, in addsitepackages
addsitedir(sitedir, known_paths)
File "/home/jaraco/jaraco.util-5.0.1/../env/lib/python2.7/site.py", line 203, in addsitedir
addpackage(sitedir, name, known_paths)
File "/home/jaraco/jaraco.util-5.0.1/../env/lib/python2.7/site.py", line 172, in addpackage
exec(line)
File "<string>", line 1, in <module>
TypeError: module.init() argument 1 must be string, not unicode
}}}

Comments (1)

  1. Log in to comment