How to package Twisted program with py2exe?

I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error.

And I found the py2exe said:

The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resources', 'pywintypes', 'resource', 'win32api', 'win32con', 'win32event', 'win32file', 'win32pipe', 'win32process', 'win32security']

So how do I solve this problem?


Asked by: Chelsea723 | Posted: 28-01-2022

Answer 1

I've seen this before... py2exe, for some reason, is not detecting that these modules are needed inside the ZIP archive and is leaving them out.

You can explicitly specify modules to include on the py2exe command line:

python py2exe -p win32com -i twisted.web.resource

Something like that. Read up on the options and experiment.

Answered by: Freddie557 | Posted: 01-03-2022

Answer 2

Had same issue with email module. I got it working by explicitly including modules in


setup(console = [''])


setup(console = [''], 

Answered by: Alfred465 | Posted: 01-03-2022

Similar questions

python - How would I package and sell a Django app?

Currently I am hosting a Django app I developed myself for my clients, but I am now starting to look at selling it to people for them to host themselves. My question is this: How can I package up and sell a Django app, while protecting its code from pirating or theft? Distributing a bunch of .py files doesn't sound like a good idea as the people I sell it to too could just make copies of them and pass them on. ...

python - How do I find the modules that are available for import from within a package?

Is there a way of knowing which modules are available to import from inside a package?

python package import fails

I've got a trac installation which works correctly from the command line. I deployed the trac.cgi to the proper directory, but when I open the page, I get: Trac detected an internal error: No module named pkg_resources Traceback (most recent call last): File "/some/path/htdocs/trac.cgi", line 22, in ? import pkg_resources ImportError: No module named pkg_resources pkg_resource...

package - What is a Python egg?

I'm new to Python and I'm just trying to understand how its packages work. Presumably eggs are some sort of packaging mechanism, but what would be a quick overview of what role they play and may be some information on why they're useful and how to create them?

Having a Python package install itself under a different name

I'm developing a package called garlicsim. (Website.) The package is intended for Python 2.X, but I am also offerring Python 3 support on a different fork called garlicsim_py3.(1) So both of these packages live side by side on PyPI, and Python 3 users install garlicsim_py3, and Python 2 users install garlicsim.

macos - using the stats package in scipy error in Python?

I am trying to use the scipy stats package in Python and am getting the following error (on Mac OS X): $ python Python 2.6.5 (r265:79359, Mar 24 2010, 01:32:55) [GCC 4.0.1 (Apple Inc. build 5493)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import scipy >>> from scipy import stats I then get the error: Traceback (m...

python - Can i take package of cpython?

I used cpython api to load py from C/C++. But, if i want not setup cpython in client, can I take package dll of cpython in my program? How to do that?

Change package import name in python

I was wondering if it was possible to import a library in python, and completely change its name. say i need to do : import plop.blah.wii but I want it to be recognized as something like import plop.blah.wii as Any idea how can this be done ? When unpickling an object, Python expects a library that I...

I have a series of python modules I would like to put into a package, how can I do this?

I have a series of python modules I would like to put into a package. I would like to set it up such that anyone interested can just download it and install it (on unix). How can I do this?

How to package a python program

Im new to python programming.Im writing a simple command line based twitter app,and i have to use external libraries like simplejson,tweepy etc. Is there a way i can package my python program to include these libraries as well,so that when i distribute this program, the user doesnt have to install the required libraries first himself ? Thank You

Still can't find your answer? Check out these communities...

PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python