pythonpydevpy2exepython-imaging-librarypyd

How to identify which .pyd files are required for the execution of exe files generated using py2exe module


I have written a python script and generated an exe using py2exe on Windows 32 bit OS. While I'm trying to execute the generated exe file, I'm getting the below error:


Traceback (most recent call last):
  File "program01.py", line 3, in <module>
  File "PIL\Image.pyc", line 67, in <module>
  File "PIL\_imaging.pyc", line 12, in <module>
  File "PIL\_imaging.pyc", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

Is there any way to identify the complete list what .pyd files are required for my program to be executed.

Below is my program import statements.

from __future__ import division
import os, sys, math, aggdraw
from PIL import Image
import xml.etree.ElementTree as ET
import lxml.etree as LETREE

Any kind of help would be appreciated!!!

Thanks, Ram


Solution

  • You can include modules by adding options argument into setup:

        options = {'py2exe': {'bundle_files': 1, 'compressed': True, "includes" : ['os', 'sys', 'math', 'aggdraw', 'PIL', 'xml.etree.ElementTree', 'lxml.etree' ]}
       }
    

    Only thing that could be different in code above is that you might need to replace xml.etree.ElementTree with xml and lxml.etree with lxml as I'm not quite sure about those.