This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: urllib cannot open data: urls
Type: Stage:
Components: Library (Lib) Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, grumpymole
Priority: normal Keywords:

Created on 2005-11-25 01:20 by grumpymole, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg26915 - (view) Author: Warren Butler (grumpymole) Date: 2005-11-25 01:20
Python 2.4.2 cannot open data: urls using open_data().

Appears to be because of importing cStringIO and not
being able to reference fileno.

==============================================
Example fail output:

Traceback (most recent call last):
  File "test_open_data.py", line 6, in ?
    response = opener.open("data:,A%20brief%20note")
  File "/usr/lib/python2.4/urllib.py", line 185, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.4/urllib.py", line 559, in
open_data
    f.fileno = None     # needed for addinfourl
AttributeError: 'cStringIO.StringI' object has no
attribute 'fileno'

==============================================
Example code to generate failure:

import urllib

# data:,A%20brief%20note

opener = urllib.URLopener()
response = opener.open("data:,A%20brief%20note")

==============================================
Note: works in 2.2 version of library.

Problem appears to be here in 2.4:

        import mimetools
        try:
            from cStringIO import StringIO
        except ImportError:
            from StringIO import StringIO

whereas 2.2 reads:

        import StringIO, mimetools, time
msg26916 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-11-26 16:52
Logged In: YES 
user_id=1188172

Fixed in revision 41548 and 41549 (2.4).
History
Date User Action Args
2022-04-11 14:56:14adminsetgithub: 42622
2005-11-25 01:20:52grumpymolecreate