Using a package like PyInstaller

LittlePython LittlePython at lost.com
Sun May 28 18:46:18 EDT 2006


Thx for the tip ... I'll give it a go


"James Stroud" <jstroud at ucla.edu> wrote in message
news:e5d593$v4p$1 at daisy.noc.ucla.edu...
> LittlePython wrote:
> > "Im 99.999% confident that this will not happen from the .exe file
> > generated by pyinstaller (unless you specify--see link above)."
> >
> > Well I guess that's about as close as any one can get in this business.
I
> > have been trying to introduce py into our environment, and have opened a
few
> > eyes, however I have been given one restriction. I can not install
anything,
> > leave behind anything or alter anything on a systems ...... period,
>
>
> You can always hard-code external resources. For example, first write a
> script that makes a module out of one or several jpegs (assuming jpeg
> extension is consitently 'jpg':
>
> import binascii
>
> def append_to_jpeg_module(modulename, jpegs):
>    myjpegs = open('%s.py' % modulename, 'wa')
>    for jpegname in jpegs:
>      afile = open('%s.jpg' % jpegname, 'rb')
>      ajpeg = afile.read()
>      afile.close()
>      jpegascii = binascii.b2a_base64(ajpeg)
>      print jpegascii
>      myjpegs.write('%s = """%s"""\n\n' % (jpegname, jpegascii))
>    myjpegs.close()
>
> append_to_jpeg_module('myjpegs', ['logo_sm'])
>
> #heres how you use it
> append_to_jpeg_module('myjpegs', ['coolpik1', 'coolpik2', 'anotherpik'])
>
> Now, in your file that needs the jpegs, you can pretend these strings
> are files with the cStringIO module, e.g. (pretending 'modulename' above
> is 'myjpegs'):
>
> import binascii
> import myjpegs
> import cStringIO
>
> def get_jpeg_as_opened_file(jpegname, module):
>    jpegascii = module.__dict__[jpegname]
>    jpegbin = binascii.a2b_base64(jpegascii)
>    return cStringIO.StringIO(jpegbin)
>
> # getting that pik
> get_jpeg_as_opened_file('coolpik1', myjpegs)
>
>
> And your company can go on making widgets feeling secure in the fact
> that you have not required any extra entries in their file allocation
> tables.
>
> James
>
> -- 
> James Stroud
> UCLA-DOE Institute for Genomics and Proteomics
> Box 951570
> Los Angeles, CA 90095
>
> http://www.jamesstroud.com/





More information about the Python-list mailing list