Including binary files in a .py file; advice needed

Peter Abel p-abel at t-online.de
Fri Jun 6 13:53:41 CEST 2003


Gary Duncan <gmduncan at netspace.net.au> wrote in message news:<3EDEB0A6.202 at netspace.net.au>...
> Here's what I want to do; distribute a .py file (a GUI app) with
> an embedded (binary) .GIF file (a photo of me at 1 yo ;) rather than
> distribute both separately. For convenience, mainly.
> 
> 
> If in a Unix shell script, I'd uuencode the .GIF and include the 
> printable-ASCII file in it as a 'here' file. When executed the script
> would 'cat' it out to e.g. a /tmp file from the main body of the script, 
> then uudecode the /tmp file to revert to the original .GIF file.
> 
> I imagine in Python, one could place the uuencoded file (lines)
> as a triple-quoted string, then uudecode it the .py program.
> 
> Anything better ?
> 
> The Martellibot's PIAN is silent on this ;
>     fine book otherwise <0.9 wink>
> 
> - Gary

Suppose you deal with TKinter. There is small tool which
does exactly what you want, I guess.

imageEmbedder 1.01 utility img2pytk.py from 
http://www.3dartist.com/WP/python/pycode.htm#img2pytk

Regards
Peter




More information about the Python-list mailing list