Recipe for py2exe and the zmq package

Error message

*** finding dlls needed ***
error: libzmq.dll: No such file or directory

or

Traceback (most recent call last):
  File "main.py", line 1, in <module>
  File "zmq\__init__.pyc", line 38, in <module>
  File "zmq\core\__init__.pyc", line 26, in <module>
  File "zmq\core\error.pyc", line 12, in <module>
  File "zmq\core\error.pyc", line 10, in __load
  File "error.pyx", line 34, in init zmq.core.error (zmq\core\error.c:1195)
ImportError: No module named strtypes

Solution

   1 from py2exe.build_exe import py2exe
   2 from distutils.core import setup
   3 import os
   4 import zmq
   5 
   6 # libzmq.dll is in same directory as zmq's __init__.py
   7 
   8 os.environ["PATH"] = \
   9     os.environ["PATH"] + \
  10     os.path.pathsep + os.path.split(zmq.__file__)[0]
  11 
  12 setup( console=[{"script": "main.py"}],
  13        options={ 
  14            "py2exe": { 
  15                "includes": 
  16                ["zmq.utils", "zmq.utils.jsonapi", 
  17                 "zmq.utils.strtypes"] } } )

Py2exeAndzmq (last edited 2012-06-25 15:48:03 by LeeKamentsky)