Embedding a binary file in a python script

Rene Pijlman reply.in.the.newsgroup at my.address.is.invalid
Wed Feb 15 11:55:29 EST 2006


mrstephengross:
>I want to find a way to embed a tar file *in* my python script, and
>then use the tarfile module to extract it. That is, instead of
>distributing two files (extractor.py and archive.tar) I want to be able
>to distribute *one* file (extractor-with-embedded-archive.py). Is there
>a way to do this? 

I guess you can uuencode your tar file, and put the result in a multiline
string. See module 'uu'.

-- 
René Pijlman



More information about the Python-list mailing list