top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Compiling multiple python scripts into an exe file

+2 votes
3,529 views

Basically, is it possible to compile multiple unrelated python scripts into a single exe file, so when execute it several python programs are run at once.

In order to use this on another machine without python installed and only by using one single file.

posted Jan 14, 2015 by Amit Mishra

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

This is my first time using pyinstaller. My goal is to build an .app in Mac. The app is basically a GUI written in PySide, and I have about 7 different Python scripts + 1 .png file. The main file calls 4 of the files, and the 4 files will call the rest of the 2 files repeatedly. The .png file is nothing but the window logo. Could someone help me with some diagnosis? I do not know what went wrong. I searched a lot of documentations online, i.e., change spec, add import, ... etc. but my app still doesn't run.FYI, Pyinstaller could generate an app for me, but there are two issues:
1. Icon is not changed for the app.
2. App crashes when opened.

My Python version is 2.7.5 and I am using PyInstaller-2.0. Here is my code for packaging:

python pyinstaller.py --onefile --windowed --name=MyApplication -i ~/Documents/AASource/icon.ico ~/Documents/AASource/Scripts/main_file.pyHere is the spec file:

$ -*- mode: python -*- a = Analysis(['/Users/boxuancui/Documents/AASource/Scripts/main_file.py'], pathex=['/Users/boxuancui/Documents/pyinstaller-2.0'], hiddenimports=[], hookspath=None) pyz = PYZ(a.pure) exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name=os.path.join('dist', 'MyApplication'), debug=False, strip=None, upx=True, console=False , icon='/Users/boxuancui/Documents/AASource/icon.ico') app = BUNDLE(exe, name=os.path.join('dist', 'MyApplication.app'))Here is part of the crash message:

Crashed Thread: 0 Dispatch queue: com.apple.main-thread Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000054d8

Thanks in advance! Any help will be appreciated!

0 votes

I need to write into a file for a project which will be evaluated on the basis of time. What is the fastest way to write 200 Mb of data, accumulated as a list into a file.

Presently I am using this:

with open('index.txt','w') as f:
 f.write("".join(data))
 f.close()

where data is a list of strings which I want to dump into the index.txt file

+1 vote

I need to write numbers into a file upto 50mb and it should be fast can any one help me how to do that? I had written the following code..

def create_file_numbers_old(filename, size):
start = time.clock()

value = 0
with open(filename, "w") as f:
while f.tell()< size:
f.write("{0}n".format(value))
value += 1

end = time.clock()

print "time taken to write a file of size", size, " is ", (end -start), "seconds n"

it takes about 20sec i need 5 to 10 times less than that.

0 votes

How can write a python script which will execute some perl scripts in a gui and shouldn't be post processed....?

+2 votes

Python scripts can run without a main(). What is the advantage to using a main()? Is it necessary to use a main() when the script uses command line arguments? (See script below)

#!/usr/bin/python

import sys

def main():
 # print command line arguments
 for arg in sys.argv[1:]:
 print arg

if __name__ == "__main__":
 main()
...