help me~!about base64

Y

ylj798

my code$B!'(B
$B!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!](B
import base64
def deflashget(st):
if st.startswith('Flashget://'):
return base64.decodestring(st[len('Flashget://'):])[10:-10]
elif st.startswith('http://') or st.startswith('ftp://'):
return 'Flashget://' + base64.encodestring('[FLASHGET]' + st
+'[FLASHGET]').replace('\n', '')

st='Flashget://
W0ZMQVNIR0VUXWh0dHA6Ly9kb3duLnJub3ZlbC5jb20vYm9va3R4dC8zLzEzNjgyLzEzNjgyLnppcFtGTEFTSEdFVF0=&1064'
print deflashget(st)
$B!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!](B
it's run ,Eric gave me error,the error is "'module' object has no
attribute 'decodestring'",
what can I do? who can help me?
 
J

Jerry Hill

2008/12/2 said:
it's run ,Eric gave me error,the error is "'module' object has no
attribute 'decodestring'",

Do you have your own base64.py (or base64.pyc) that's shadowing the
standard module base64? Try this:

What does that say when you do it?
 
Y

ylj798

Do you have your own base64.py (or base64.pyc) that's shadowing the
standardmodulebase64? Try this:


C:\Python25\lib\base64.py



What does that say when you do it?
look,when i work it,tell me blow
/usr/lib/python2.5/base64.pyc
 
J

Jerry Hill

/usr/lib/python2.5/base64.pyc

That looks fine, and matches what I have on my linux box. Your code
works fine for me when I run it, so I'm out of ideas.
 
Y

ylj798

That looks fine, and matches what I have on my linux box. Your code
works fine for me when I run it, so I'm out of ideas.
Thanks~!
My system is ubuntu8.04 python2.5 eric4,you don't know that what
about error?
 
D

Diez B. Roggisch

my code$B!'(B
$B!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!](B
import base64
def deflashget(st):
if st.startswith('Flashget://'):
return base64.decodestring(st[len('Flashget://'):])[10:-10]
elif st.startswith('http://') or st.startswith('ftp://'):
return 'Flashget://' + base64.encodestring('[FLASHGET]' + st
+'[FLASHGET]').replace('\n', '')

st='Flashget://
W0ZMQVNIR0VUXWh0dHA6Ly9kb3duLnJub3ZlbC5jb20vYm9va3R4dC8zLzEzNjgyLzEzNjgyLnppcFtGTEFTSEdFVF0=&1064'
print deflashget(st)
$B!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!]!](B
it's run ,Eric gave me error,the error is "'module' object has no
attribute 'decodestring'",
what can I do? who can help me?

How is the file called that the above code is in? I *bet* it is called
base64.py, or has been called that way. Jerry had the same idea, however
you must make sure that the code he gave you is run from inside the
above module - because only then you'll have the same environment.
Python on the commandline isn't sufficient.

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,744
Latest member
CortneyMcK

Latest Threads

Top