From: Noam B. A. <noa...@bg...> - 2008-12-08 11:29:51
|
Hi all, I'm trying to convert an experiment written in Python (2.6) and WxPython (wx-2.8-msw-unicode) using py2exe (0.6.9). The experiment will take place in a computer lab where I don't have privileges to install anything and Python is not installed there. When I tried for the first time py2exe the conversion failed as msvcp90.dll was missing on my computer. I installed .net framework 3.0 and than copied the msvcp90.dll into c:\Python26\DLLs folder. Following that it was possible to convert the Pythons scripts into a big happy folder (dist). The output of the process included a list of dlls that are required (python26.dll, msvcp90.dll and more...). After putting all the dlls in the dist folder I'm still unable to run the .exe file in other computers than the one the .exe was created on. The first setup.py file I used was: from distutils.core import setup import py2exe import sys # no arguments if len(sys.argv) == 1: sys.argv.append("py2exe") # creates a standalone .exe file, no zip files setup( windows = [{"script": 'NewExperiment.py'}] ) *Why I can't run the file on other computers and how do I solve it (file size is not an issue)?* Following I tried this setup.py file based on the advanced example: from distutils.core import setup import py2exe import sys # If run without args, build executables, in quiet mode. if len(sys.argv) == 1: sys.argv.append("py2exe") sys.argv.append("-q") class Target: def __init__(self, **kw): self.__dict__.update(kw) # for the versioninfo resources self.version = "0.6.9" self.company_name = "No Company" self.copyright = "no copyright" self.name = "py2exe sample files" ################################################################ # A program using wxPython # The manifest will be inserted as resource into test_wx.exe. This # gives the controls the Windows XP appearance (if run on XP ;-) # # Another option would be to store it in a file named # test_wx.exe.manifest, and copy it with the data_files option into # the dist-dir. # manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32" /> <description>%(prog)s Program</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> ''' RT_MANIFEST = 24 NewExperiment = Target( # used for the versioninfo resource description = "A sample GUI app", # what to build script = "NewExperiment.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="NewExperiment"))], ## icon_resources = [(1, "icon.ico")], dest_base = "NewExperiment") #test_wx_console = Target( # # used for the versioninfo resource # description = "A sample GUI app with console", # # what to build # script = "NewExperiment.py", # other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="NewExperiment"))], # dest_base = "NewExperiment_console") ################################################################ #excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon", # "pywin.dialogs", "pywin.dialogs.list"] excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon", "pywin.dialogs", "pywin.dialogs.list"] setup( options = {"py2exe": {"typelibs": # typelib for WMI [('{565783C6-CB41-11D1-8B02-00600806D9B6}', 0, 1, 2)], # create a compressed zip archive "compressed": 1, "optimize": 2, "excludes": excludes}}, # The lib directory contains everything except the executables and the python dll. # Can include a subdirectory name. zipfile = "lib/shared.zip", # service = [myservice], # com_server = [interp], # console = [test_wx_console, test_wmi], windows = [NewExperiment], ) *Now the conversion to .exe file fails - ImportError: no module named win32com.* * * So how do I proceed? Best, Noam ** |