REPOST: Re: base64.decodestring gives binascii.error

Alex Martelli aleax at
Fri Dec 28 11:42:47 EST 2001

"Erik Myllymaki" <erik at> wrote in message
news:3C2C9D79.9050501 at
> The '_' and '!' were in the original string that was then encoded, not
> in the resulting encoded string.

Then, it's clearly a bug in the base64 module you're using.  I
don't see it here:

>>> x=base64.encodestring('oh_my!')
>>> x
>>> base64.decodestring(x)

[original context was -- oh those hateful add-in-front habits!:

> >>should base64.decodestring give a binascii.error if it encounters
> >>special chars like '_' and '!' ?
> >
> > Makes sense to me; after all, such characters should never be
> > in a string produced by base64, so the data must have been
> > damaged in transit -- raising an exceptions seems appropriate.



========= WAS CANCELLED BY =======:
From: "Alex Martelli" <aleax at>
Newsgroups: comp.lang.python
Subject: cmsg cancel <a0i7e6$2td$1 at>
Control: cancel <a0i7e6$2td$1 at>
Date: Mon, 31 Dec 2001 02:09:17 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.a0i7e6$2td$1 at>
X-Trace: 1009775207 27193 (31 Dec 2001 05:06:47 GMT)
X-Complaints-To: usenet at
NNTP-Posting-Date: Mon, 31 Dec 2001 05:06:47 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)

This message was cancelled from within Mozilla.

More information about the Python-list mailing list