Take the 2-minute tour ×
import base64
if __name__ == '__main__':
    res = base64.encodestring('srcdasd')        

I run in console python base64.py, get the below error message.

but i can run it in textMate correctly.

AttributeError: 'module' object has no attribute 'encodestring'

share|improve this question

1 Answer 1

up vote 4 down vote accepted

The name of your file should not be base64.py, it collides with the module you're using. Rename your file, that should solve it.

share|improve this answer
good ,it work!,thank you! –  user1292717 Dec 6 '12 at 6:51

Your Answer


