473,383 Members | 1,952 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Using a package like PyInstaller

Is it possible when using packages like PyInstaller to create an .exe for
distribution that parts of the package can bleed out and be left on a system
when the .exe is executed?

Thx
May 27 '06 #1
8 2404
LittlePython wrote:
Is it possible when using packages like PyInstaller to create an .exe for
distribution that parts of the package can bleed out and be left on a system
when the .exe is executed?

Thx


Look at innosetup.

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
May 27 '06 #2
Thx for the tip.

I am referring more to the use of PyInstaller or py2exe. Packages that
create exe files that basically have your py script and a small py
interpreter all rolled up into one. This way py does not need to be
installed on a system to execute a py script. I am being advised that python
is installed onto systems (windows) it should not be on. I am new to python
and these types of packages and am not too sure how dumb a question this
really is.. but can these packages bleed out files, dll, exe ect. to systems
they are run on?

"James Stroud" <js*****@ucla.edu> wrote in message
news:e5**********@daisy.noc.ucla.edu...
LittlePython wrote:
Is it possible when using packages like PyInstaller to create an .exe for distribution that parts of the package can bleed out and be left on a system when the .exe is executed?

Thx


Look at innosetup.

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/

May 27 '06 #3
LittlePython wrote:
Thx for the tip.

I am referring more to the use of PyInstaller or py2exe. Packages that
create exe files that basically have your py script and a small py
interpreter all rolled up into one. This way py does not need to be
installed on a system to execute a py script. I am being advised that python
is installed onto systems (windows) it should not be on. I am new to python
and these types of packages and am not too sure how dumb a question this
really is.. but can these packages bleed out files, dll, exe ect. to systems
they are run on?


They don't have to "bleed" anything. Everything, including the python
interpreter, and 3rd party libraries can be included in a single
executable. Here is an example script for pyinstaller that rolls
evertyhing into one file (this is what I use to roll up my passerby
program at passerby.souceforge.net):
setenv TEMP temp

set pythonexe='c:/Python23-Enthought/python'
set pbydir='z:/Code/pby/current/'

rm *.pyc

rm -rf ./temp/ ./passerby/
mkdir temp

$pythonexe Configure.py
$pythonexe Makespec.py --onefile --tk --noconsole \
--icon $pbydir/../icons/passerby.ico \
$pbydir/passerby.py passerby/passerby.spec
$pythonexe Build.py passerby/passerby.spec
You can control installation with innosetup.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
May 27 '06 #4
That is very close to what I have being doing, however I was unable to
enclose a bmp or another file for that matter in the exe. I used both DATA
and BINARY key words with no luck. I checked what was in the package and
there were there. I guess for some reason it could not locate then when
executed. I used snap 274 if I remember correctly.

I am not too sure I am explaining my question correctly though. I have not
problem creating and distributing my python/wxpython scripts in exe
(stand-a-lone) except for what I have described above. I am worrying that
when the py script is run I am leaving behind files. That the components of
my stand-alone exe is somehow coming out of the exe (PyInstaller) and being
installed.

My setup exe is not what's is bothering me although I do like the your
suggestion and have just been tinkering with it. It is cool stuff and much
better then what I have been using.

Thx

"James Stroud" <js*****@ucla.edu> wrote in message
news:e5**********@daisy.noc.ucla.edu...
LittlePython wrote:
Thx for the tip.

I am referring more to the use of PyInstaller or py2exe. Packages that
create exe files that basically have your py script and a small py
interpreter all rolled up into one. This way py does not need to be
installed on a system to execute a py script. I am being advised that python is installed onto systems (windows) it should not be on. I am new to python and these types of packages and am not too sure how dumb a question this
really is.. but can these packages bleed out files, dll, exe ect. to systems they are run on?


They don't have to "bleed" anything. Everything, including the python
interpreter, and 3rd party libraries can be included in a single
executable. Here is an example script for pyinstaller that rolls
evertyhing into one file (this is what I use to roll up my passerby
program at passerby.souceforge.net):
setenv TEMP temp

set pythonexe='c:/Python23-Enthought/python'
set pbydir='z:/Code/pby/current/'

rm *.pyc

rm -rf ./temp/ ./passerby/
mkdir temp

$pythonexe Configure.py
$pythonexe Makespec.py --onefile --tk --noconsole \
--icon $pbydir/../icons/passerby.ico \
$pbydir/passerby.py passerby/passerby.spec
$pythonexe Build.py passerby/passerby.spec
You can control installation with innosetup.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/

May 28 '06 #5
LittlePython wrote:
That is very close to what I have being doing, however I was unable to
enclose a bmp or another file for that matter in the exe. I used both DATA
and BINARY key words with no luck. I checked what was in the package and
there were there. I guess for some reason it could not locate then when
executed. I used snap 274 if I remember correctly.
You can include files with innosetup under the [FILES] section. The docs
show how. You can then code absolute paths to these resources in your
code according to the results of 'sys.platform'. If you use the
"--onedir" option, then you may want to look here:

http://pyinstaller.hpcf.upr.edu/docs...ing-data-files

I am worrying that
when the py script is run I am leaving behind files. That the components of
my stand-alone exe is somehow coming out of the exe (PyInstaller) and being
installed.


Im 99.999% confident that this will not happen from the .exe file
generated by pyinstaller (unless you specify--see link above).

However, innosetup will put files in the 'Program Files' directory or
wherever you specify. This would be similar to just about every other
application out there for windows.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/
May 28 '06 #6
"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, and as
the saying goes "To error is human but to forgive is not company policy!"

thx for your comments!

"James Stroud" <js*****@ucla.edu> wrote in message
news:e5**********@daisy.noc.ucla.edu...
LittlePython wrote:
That is very close to what I have being doing, however I was unable to
enclose a bmp or another file for that matter in the exe. I used both DATA and BINARY key words with no luck. I checked what was in the package and
there were there. I guess for some reason it could not locate then when
executed. I used snap 274 if I remember correctly.


You can include files with innosetup under the [FILES] section. The docs
show how. You can then code absolute paths to these resources in your
code according to the results of 'sys.platform'. If you use the
"--onedir" option, then you may want to look here:

http://pyinstaller.hpcf.upr.edu/docs...ing-data-files

I am worrying that
when the py script is run I am leaving behind files. That the components of my stand-alone exe is somehow coming out of the exe (PyInstaller) and being installed.


Im 99.999% confident that this will not happen from the .exe file
generated by pyinstaller (unless you specify--see link above).

However, innosetup will put files in the 'Program Files' directory or
wherever you specify. This would be similar to just about every other
application out there for windows.

James

--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095

http://www.jamesstroud.com/

May 28 '06 #7
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/
May 28 '06 #8
Thx for the tip ... I'll give it a go
"James Stroud" <js*****@ucla.edu> wrote in message
news:e5**********@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/

May 28 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: niclane | last post by:
Hi, I have some python scripts, I need to run a netgear router, i have a cross compilation setup that works for c code no problem. the python interpreter doesn't appear to have been...
1
by: kbperry | last post by:
Hi all, I am pretty confused on this? While pyinstaller has a "MakeCOMServer.py" thing, it seems to blow up every time I run it. It keeps complaining that a dictionary that I have has...
10
true911m
by: true911m | last post by:
This is a simple walkthrough to get PyInstaller up and running. I decided to give PI a try, because it claims to be more selective about what it bundles into its executable files by default, and...
0
by: theJade | last post by:
Hi Everyone, Can anyone who is familiar with pyinstaller explain how the command line options work. Below I have an sample of my spec file: a = Analysis(, pathex=) pyz =...
2
by: Marcus | last post by:
Hi, I'm to the stage where I need to deploy the app I built with wxPython. I've been able to successfully build it w/py2exe into a binary (about 10MB size in total). What I'd like to do is...
0
by: linea | last post by:
When I install PyInstaller, it has some error. cd source/linux python ./Make.py Warning: could not find python static library at :/usr/lib/python2.5/config/libpython2.5.a Now run "make" to...
7
luke14free
by: luke14free | last post by:
Hello, I'm working on a project and I need to compile it to run it on win as an exe. I choose pyinstaller to build my exe but after several tries my result is always the same, from my console...
0
by: Thin Myrna | last post by:
I gave PyInstaller a shot and was pleased by the results so far. The usual problems occurred with missing data and icon files (the latter for splash screens only). However, it's a bit hard for me...
1
by: Mark Delon | last post by:
Hi, I need to generate single EXEcutable via PyInstaller. It will be genereated -i get one single executable. AFTER CALL (exe) I get an error: "no module named _gt" Build command: 1....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.