Skip to content

Instantly share code, notes, and snippets.

Created August 1, 2013 19:41
What would you like to do?
Convert base64-encoded data from an exported Evernote note back to its original form.
#!/usr/bin/env python
# Copyright 2013 Evernote Corporation. All rights reserved.
import base64
import sys
# Copy the base64 string from the ENEX file and put it into a file
# Pipe base64-encoded data to STDIN
data =
# Decode data
imgraw = base64.b64decode(data)
except TypeError, te:
print 'TypeError: ', te
raise SystemExit
# Write it to the file passed as a param
with file(sys.argv[1], 'wb') as outfile:
## Usage:
## (Change myfile.ext to the desired filename and correct extension)
# cat base64File | python myfile.ext
## or, if you base64 data is in the pasteboard on a Mac:
# pbpaste | python myfile.ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment