Including binary files in a .py file; advice needed
Grant Edwards
grante at visi.com
Fri Jun 6 10:50:05 EDT 2003
In article <3EDEB0A6.202 at netspace.net.au>, Gary Duncan wrote:
> 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.
Here's how I did it:
LogoString = """R0lGODdhtQByAPcAAAAAAA4DBA4NCxsGBxwaFSkJCyonIDYMDjgqIzg0KkQOEkQZGUY3LkZB
NVERFVREOFROP18UGWE9NWJbSmwXHW0rK242Mm9KQG9UR3FpVXoaIH92X4cdJIgxMok7OYlG
QI2DapUgJ5UqLpdIQ5uQdKIjK6MtMqM3OaRBQKZqXKd0Y6d+aqiTeKmdf7AlLrJOSraggreq
ib0oMr9RTsKEccSjhsW3lMsrNcs1PM1UUc5oX9CHdNCRe9GbgtGlidKwkNK6l9PEntguOdk4
QNlCR9pNTtpXVdthXNtrY9x1at2Acd6Uf96eht+ojeC9m+DHouHRqQLzAAD/AAC/ANgkqP30
[...]
2FU4hRenxTmuXK4nJOn0AsBgy54dea/+717PvABAFYSh97yhWs+4xD8y944vHyQNqIzyn0/9
6lv/+hEPCAA7
"""
LogoImage = PhotoImage(data=LogoString)
> 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.
Sounds complicated with temp file and all.
--
Grant Edwards grante Yow! A GRAM?? A BRAM... A
at GROOM... A BROOM... Oh,
visi.com Yeh!! Wash the ROOM!!
More information about the Python-list
mailing list