Page 2 of 2 First 12
  • Jump to page:
    #16
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    netherlands
    Posts
    51
    Rep Power
    11
    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:

    In simple cases, only pythonxx.dll is needed in addition to myscript.exe. If, however, your script needs extension modules, unfortunately those cannot be included or imported from the zip-archive, so they are needed as separate files (and are copied into the dist\myscript directory).
    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!
  2. #17
  3. Hello World :)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2003
    Location
    Hull, UK
    Posts
    2,537
    Rep Power
    69
    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.

    --excludes or -e list
    comma separated list of modules to exclude
    --includes or -i list
    comma separated list of modules to include. Note that includes overrides excludes.
    Mark.
    programming language development: www.netytan.com Hula

  4. #18
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Location
    netherlands
    Posts
    51
    Rep Power
    11
    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!!!

    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.
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo