Archived

This forum has been archived. Please start a new discussion on GitHub.

Python Import Problem w/Ice 3.5

Much like this previous thread
I am having trouble importing IcePy into Python.
Specifically I get the error:
import Ice
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\ZeroC\Ice-3.5.0\python\Ice.py", line 47, in <module>
    import IcePy
ImportError: DLL load failed: The specified module could not be found.

import IcePy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.

I am using Python 2.7.2, Ice 3.5.0, and Windows XP

Like the previous thread I have made sure PythonPath and Path both have been configured and set to the python and bin folders.

Am I missing something, or doing something wrong?

Comments

  • mes
    mes California
    Hi,

    Welcome to the forum.

    Our Python extension in Ice 3.5.0 was compiled against Python 3.3 and won't be compatible with older Python versions. If you need to use an older version of Python, you could fall back to Ice 3.4.2, which was compiled against Python 2.6. If you must use Python 2.7, your only option would be to compile the extension from source.

    Note that when I try to load the Ice 3.5.0 extension on Windows XP with Python 2.7, I get this error message:
    >>> import Ice
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "C:\Program Files\ZeroC\Ice-3.5.0\python\Ice.py", line 47, in <module>
        import IcePy
    ImportError: Module use of python33.dll conflicts with this version of Python.
    

    Regards,
    Mark
  • Mark,
    mes wrote: »
    Our Python extension in Ice 3.5.0 was compiled against Python 3.3 and won't be compatible with older Python versions.

    I was confused by this page of supported platforms for Ice 3.5.0
    If you must use Python 2.7, your only option would be to compile the extension from source.

    Would you know of a good walkthrough/guide/instructions for this, I always seem to fail when trying to compile on my own.

    Thank you for your help!

    -Frank V.
  • mes
    mes California
    You need to compile the Python extension using the same compiler as the Python interpreter. Python 2.7 is compiled with Visual Studio 2008 (Visual C++ 9), so that is the first prerequisite.

    Visit our download page and download Ice-3.5.0.zip and Ice-3.5.0-ThirdParty.msi. Install the MSI in the default directory (you can uninstall it later).

    Extract Ice-3.5.0.zip.

    Open a Visual Studio command prompt and build the minimal C++ run time:

    > cd Ice-3.5.0\cpp\src
    > nmake /f Makefile.mak OPTIMIZE=yes
    > cd slice2py
    > nmake /f Makefile.mak OPTIMIZE=yes

    Edit Ice-3.5.0\py\config\Make.rules.mak and change the values of prefix and PYTHON_HOME.

    Build the Python extension:

    > cd Ice-3.5.0\py
    > nmake /f Makefile.mak

    Install the Python extension (this will copy files into the directory you specified for prefix):

    > cd Ice-3.5.0\py
    > nmake /f Makefile.mak install

    Now you can remove the Ice-3.5.0 source directory and uninstall the third-party files.

    You should still keep the bin directory of the Ice 3.5.0 MSI installation (usually C:\Program Files\ZeroC\Ice-3.5.0\bin) in your PATH.
  • Follow Up
    mes wrote: »
    You need to compile the Python extension using the same compiler as the Python interpreter. Python 2.7 is compiled with Visual Studio 2008 (Visual C++ 9), so that is the first prerequisite.

    I don't know if anyone else will run into this issue, just in case here are the python and bin folders compiled against Python 2.7 for use with Ice 3.5.
    Attachment not found.
    Attachment not found.

    Place the files inside of their respective Ice-3.5.x\python and Ice-3.5.x\bin folders, most of the files will be overwritten, but, in the case of the bin folder, some are not.

    Good luck!
    -Frank V.