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.

Author loewis
Recipients loewis
Date 2009-01-10.19:32:32
SpamBayes Score 1.7195836e-05
Marked as misclassified No
Message-id <1231615953.75.0.823644333839.issue4909@psf.upfronthosting.co.za>
In-reply-to
Content
The fragment

try:
    import cStringIO as StringIO
except ImportError:
    import StringIO
s=StringIO.StringIO()

gets rewritten to

try:
    import io as StringIO
except ImportError:
    import io
s=io.StringIO()

Unfortunately, that code fails to work: the first import succeeds,
actually binding StringIO; the name io is unbound and gives NameError.

Apparently, the fixer choses to replace all occurrences of StringIO with
io; it should extend this replacement to "as" clauses.

My work-around is to import as _StringIO in both cases, and then refer
to the module as _StringIO.
History
Date User Action Args
2009-01-10 19:32:33loewissetrecipients: + loewis
2009-01-10 19:32:33loewissetmessageid: <1231615953.75.0.823644333839.issue4909@psf.upfronthosting.co.za>
2009-01-10 19:32:32loewislinkissue4909 messages
2009-01-10 19:32:32loewiscreate