| Originally posted by netytan |
[B]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..
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.
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 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 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. |
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!!!
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