#1
  1. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539

    Compiling COM server with Py2exe


    Hi all, I've found wh2fax an Hylafax client which uses a COM server written in Python, which comes as .py file (exactly 2 files hfaxcom.py and hfaxlib.py). Now I want to use that COM server with other programs and to ease distribution I'd like to compile it with py2exe.
    Right now I'm getting errors like:
    ImportError: No module named pywintypes
    I'm on win2k with python22 and a recent py2exe.
    setup.py contains the following
    from distutils.core import setup
    import py2exe
    setup(name="hylafaxutil", scripts=["hfaxcom"])
    Has anyone already accomplished this? Can you help me?
    I know absolutely nothing about python, just need the com server

    Thanks in advance.
  2. #2
  3. Mini me.
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Cambridge, UK
    Posts
    783
    Rep Power
    13
    Hi Pabloj,

    I haven't tested this but I looked at the code....
    The pywintypes module actually replaces references to itself with a link to a dll called pywintypesXX.dll Where XX is the python version. Unless Py2exe handles this as a special case it will not know how to include the dll.

    I suggest the solution will be to either manually copy pywintypes22.dll to the directory of your program or you can include it in the list of files of your py2exe script.
    Code:
    setup(name="hylafaxutil", scripts=["hfaxcom"],
        data_files = [(r"location_of_dll",[pywintypes22.dll,])]
       )
    You never know..
    Grim:
    Last edited by Grim Archon; January 19th, 2004 at 05:59 AM.
  4. #3
  5. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
    I'try and let you know the results.
    Thank you very much!!!!

IMN logo majestic logo threadwatch logo seochat tools logo