0

In mainwindow.py file i have use this line,

ctypes.windll.LoadLibrary("ptzdll/PTZ.dll")
from PTZ import PTZDevice, PTZType

When i execute mainwindow.py file with terminal(python mainwindow.py), it works, but when i double click on exe file made by py2exe, it gives error:

**No module named PTZ.**

My setup.py file code:

from distutils.core import setup
from glob import glob
import py2exe

from distutils.filelist import findall
import matplotlib
import cv2
import numpy
import tkMessageBox
import easygui
import os



datafiles = [
        ("resources", glob('resources/*.*'))
]


datafiles.append(('ptzdll', [
                'PTZ.dll',
                'DirectShowLib-2005.dll'
                ]))    

setup(
        console=['mainwindow.py'],
        #'file_resources': [bitmap_string[:-1]],

        options = {
                    'py2exe': {
                    'packages' : ['matplotlib','ctypes','_ctypes'],
                    'dll_excludes': ['libgdk-win32-2.0-0.dll', 
                                     'libgobject-2.0-0.dll', 
                                     'libgdk_pixbuf-2.0-0.dll'],
                    r'includes': [r'scipy.sparse.csgraph._validation',
                                  r'scipy.special._ufuncs_cxx']
                                }
                    },
        zipfile = None,
        windows = [{
                    "script":"mainwindow.py",
                    "icon_resources":[(1, "tfr.ico")],

                    }],
        data_files = datafiles,
        #data_files = datafiles
        )
jatinkumar patel
  • 2,920
  • 21
  • 28

1 Answers1

0

The PTZ.dll is not in your *\dist\ptzdll folder, but in *\dist\library.zip\ptzdll\PTZ.dll.