Issue #5 resolved

Using hg command line with Py3 does not work.

Jurko Gospodnetić
created an issue

When you use the hg command line, data returned by the subprocess.POpen object's communicate() function are byte streams. Because of that, calling splitline() on them returns a list of file names as bytes objects.

Later on when setuptools tries to do some regexs pattern matching on those file names you get an exception 'TypeError: can't use a string pattern on a bytes-like object'.

Stack trace: {{{ File "C:\Program Files\Python\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\setuptools\command\egg_info.py", line 179, in run self.find_sources() File "C:\Program Files\Python\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\setuptools\command\egg_info.py", line 254, in find_sources

mm.run()

File "C:\Program Files\Python\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\setuptools\command\egg_info.py", line 311, in run self.prune_file_list() File "C:\Program Files\Python\Python32\lib\site-packages\distribute-0.6.24-py3.2.egg\setuptools\command\egg_info.py", line 346, in prune_file_l ist self.filelist.exclude_pattern(None, prefix=build.build_base) File "C:\Program Files\Python\Python32\lib\distutils\filelist.py", line 235, in exclude_pattern if pattern_re.search(self.files[i]): TypeError: can't use a string pattern on a bytes-like object }}}

I'm running this with Python 3.2.2 on Windows XP x86 SP3.

Used Python packages: * distribute 0.6.24 * setuptools_hg 0.3

The issue can be quick-fixed in my case by replacing: {{{ return stdout.splitlines() }}} with {{{ return (x.decode('utf-8') for x in stdout.splitlines()) }}} at the end of find_files_with_cmd() but I am pretty sure this is not a completely valid or clean fix.

Note that using the mercurial package with Py3 is not supported. :-(

Hope this helps, Jurko Gospodnetić

Comments (5)

  1. Log in to comment