Sign in to follow this  

a question about py2exe

This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, is there any way to put all the extra files that py2exe gives in its own directory? there is a zip file, 4 .pyd files, and the .dll file that py2exe produces for me. (btw, this is a lot of stuff for only a 20 line python script.. is that normal?) id like to stuff all this stuff in a sub folder and have my .exe in a main folder. is this possible? also, if its not possible, do you think it would be a better idea to write a C++ program which has my script hard-coded into it, and have its only purpose to execute this script? i remember the glue code for Python being kind of tedious though, however i think just executing a script should be simple. thanks for any help.

Share this post


Link to post
Share on other sites
I found this on the py2exe wiki.

Quote:

Once you've built your executable with py2exe, then compile the installer script with NSIS and an executable will be created in the same folder as the script. When run, that single file executable will expand the original executable created by py2exe along with all the dll, pyd, and data files for your application into a temporary directory and run it. When your application exits, the temp folder will be deleted automatically.


Not exactly what you're looking for, but interesting nonetheless.

Share this post


Link to post
Share on other sites
hey,

thanks a lot! this is exactly what i was looking for. however, ive run into some problems [smile]. i cant get this to work.

ok, so ive never used NSIS before, so i download it. then i copy the script and change the top 2 lines like the instructions say. i put the script in the folder with my setup.py file and then compile it uses NSIS. it outputs the all-in-one exe for me.

however, the result is rather odd. first of all, using the first example they give, the one which doesnt use compression, the output is "dead". i click the .exe file, but absolutely nothing happends.

now, if i use the second script they showed, the one which uses compression, it works, however, the end result is rather off. my python script that i want to "wrap up" into an exe is an auto-patcher for my online RPG. the autopatcher downloads a file off my website, and then executes the file as it closes.

when i run the all-in-one exe, my firewall pops up telling me it wants access to the internet, so i allow it.. but then, nothing happends... now, the file im downloading is a console application, written in C++. i found it odd that my firewall was telling me that it at least started to work, but nothing appeared on the screen.. so i hit ctrl-alt-delete, and lo and behold, the .exe i wanted to download is apprently running as a proccess on my machine. however, i cant find this anywhere... ok, so it worked, it executed the script, the script downloaded the file and executed the file, and the file is running.. but.. absolutely nothing appears on the screen, for either the script itself or the file it downloaded..

does anyone have any clue why the first .nsi file did not work? and, does anyone know why when using the second nsi file, i cannot see the program that my script downloaded? it seems to work fine with non-console applications though.

also note: im using execv() to execute the file that the script downloads. this means it should replace the current proccess, so that it doesnt open a new console window..

thanks for any help.

Share this post


Link to post
Share on other sites
i guess this is a long shot, but..

does anyone have any clue why using the NSIS all-in-one-exe makes my exe invisable? whats even stranger is, the fact that it seems to be running as a proccess. i dont see the app running in the "Application" section of the task manager, only on the "Processes" tab..

thanks for any help.

Share this post


Link to post
Share on other sites
in case anyone ever searches or something, i found an excellent solution to this problem.

this page has a very nice system for getting your python scripts into single .exe files. and even better - it does all the work for you. just download the file, open setup.py and change the name of the script to the name of the script you want to turn into an exe. then just execute setup.py. your exe file will be created automatically and put in the directory. very, very nice.

it also compresses all your files so that the exe remains a decent size. it uncompresses everything to a temp file and cleans it up automatically when you use it. also, it even takes command line arguements.

Share this post


Link to post
Share on other sites

This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this