Skip to content
Advertisement

base64 miss encodestring

import base64
if __name__ == '__main__':
    res = base64.encodestring('srcdasd')        
    print(res)

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’

Advertisement

Answer

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.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement