Issue #160 resolved

2.7 gives ValueError("Invalid IPv6 URL")

Sridhar Ratnakumar
created an issue

This happens only in Python 2.7 (not in Python 2.6). To reproduce, just type "easy_install django-cms"

{{{ $ /tmp/e7/bin/easy_install django-cms install_dir /tmp/e7/lib/python2.7/site-packages/ Searching for django-cms Reading http://pypi.python.org/simple/django-cms/ Traceback (most recent call last): File "/tmp/e7/bin/easy_install", line 9, in <module> load_entry_point('distribute==0.6.12', 'console_scripts', 'easy_install')() File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/command/easy_install.py", line 1855, in main with_ei_usage(lambda: File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/command/easy_install.py", line 1836, in with_ei_usage return f() File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/command/easy_install.py", line 1859, in <lambda> distclass=DistributionWithoutHelpCommands, **kw File "/home/apy/APy27/lib/python2.7/distutils/core.py", line 152, in setup dist.run_commands() File "/home/apy/APy27/lib/python2.7/distutils/dist.py", line 953, in run_commands self.run_command(cmd) File "/home/apy/APy27/lib/python2.7/distutils/dist.py", line 972, in run_command cmd_obj.run() File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/command/easy_install.py", line 343, in run self.easy_install(spec, not self.no_deps) File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/command/easy_install.py", line 569, in easy_install spec, tmpdir, self.upgrade, self.editable, not self.always_copy File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/package_index.py", line 468, in fetch_distribution self.find_packages(requirement) File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/package_index.py", line 309, in find_packages self.scan_url(self.index_url + requirement.unsafe_name+'/') File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/package_index.py", line 643, in scan_url self.process_url(url, True) File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/package_index.py", line 207, in process_url page = self.process_index(url, page) File "/tmp/e7/lib/python2.7/site-packages/distribute-0.6.12-py2.7.egg/setuptools/package_index.py", line 271, in process_index scan( urlparse.urljoin(url, htmldecode(match.group(1))) ) File "/home/apy/APy27/lib/python2.7/urlparse.py", line 242, in urljoin urlparse(url, bscheme, allow_fragments) File "/home/apy/APy27/lib/python2.7/urlparse.py", line 134, in urlparse tuple = urlsplit(url, scheme, allow_fragments) File "/home/apy/APy27/lib/python2.7/urlparse.py", line 182, in urlsplit raise ValueError("Invalid IPv6 URL") ValueError: Invalid IPv6 URL

}}}

Comments (6)

  1. Sridhar Ratnakumar reporter
    [storage@nas0 ~]$ python2.6 -c "import urlparse; print urlparse.urlsplit('http://www.famfamfam.com](http://www.famfamfam.com/', 'http', True)"
    SplitResult(scheme='http', netloc='www.famfamfam.com](http:', path='//www.famfamfam.com/', query='', fragment='')
    [storage@nas0 ~]$ python2.7 -c "import urlparse; print urlparse.urlsplit('http://www.famfamfam.com](http://www.famfamfam.com/', 'http', True)"
    ('urlsplit() - %s, scheme=%s, allow_fragments=%s', 'http://www.famfamfam.com](http://www.famfamfam.com/', 'http', True)
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/home/apy/APy27/lib/python2.7/urlparse.py", line 184, in urlsplit
        raise ValueError("Invalid IPv6 URL")
    ValueError: Invalid IPv6 URL
    [storage@nas0 ~]$
    
  2. Sridhar Ratnakumar reporter

    +1 for ignoring such malformed URLs on Distribute side ... which would be made easier/reliable if urlparse threw a custom exception.

    PS: I have been using Python 2.7 with Distribute in our production PyPM backend, and finding these bugs.

  3. Log in to comment