December 20th, 2003, 07:15 AM
I have a (hopefully small) problem with py2exe
I've played a bit with everything and I found a faster way to patch my program if needed.
So it now consists of different modules, one is the main one, from which every other will be imported.
I import an executable module that writes a file. The problem is that when I import this module to use it for py2exe, the command 'import module' executes this module, breaking the setup script.
I think this is an extension module? So it can't be included. The py2exe site says this:
As it isn't included default now, how do I make it so that it's included. Do i just have to copy the .py extension files into the directory, or do I have to write it somwhere in the setup.py file, or do I have to use a command line command to include them?
Thanks for the help!
December 20th, 2003, 01:00 PM
Very bad idea, if your going to write modular code i sugest you look into classes or at the very least functions and then call these from a main file..
Having a module which does somthing on import little scary; and hard to debug if somone else desided to use it as a base for another app.
I don't know how py2exe handles this kind of thing, but you should give the -i flag a go and see if that works for you.
December 20th, 2003, 03:07 PM
I know it's a bad idea, it was said in the tutorial as well, and if py2exe doesn't support it directly...
It looks like classes are what I want to use, going to give that a better look. I can't use the def statement, as my program is something like this:
user input in main script - call another script, depending on the input, that does the work - possibility to loop the main script.
That called script has some printed lines first giving a few hints to the user for what to do. (basically it's the input for and writing of the file in my above code but it's not really important what it is) If I use the def statement you have to input those variables between the ( and ) so the print lines will never never show up.
I found that quite useful, actually. If someone wants to use it he can just pick the module and use it as well, no trouble with stuff that's defined in/by other scripts, immediately the right thing with everything that's needed, not more and not less. Though that's probably because I'm new
I shall see if it works but if so I'll also start to make it so it's not needed.
Thanks for the help!!!
edit: saw a script using def with prints in it working so must be something i did/am doing wrong. Will look at that as well
Last edited by darkleaf; December 20th, 2003 at 03:27 PM.