On 9 January 2011 12:18, <[email protected]> wrote: > I'm using Python 3.1 under Windows XP (SP3, Version 5.1.2600). I'm trying to > freeze a simple 'Hello world' example script to an .exe file but cx_Freeze > always cancels with this error message: struct.error: required argument is > not an integer > > It's the same for all the sample scripts in > C:\Python31\Lib\site-packages\cx_Freeze\samples\simple etc. Can anybody > please verify that error (or bug?)? Here's my code: > > program.py: > > print("Hello World!") > > setup.py (call with: 'C:\Python31\python.exe setup.py build'): > > from cx_Freeze import setup, Executable > setup( > name = "My Program", > description = "A simple Hello World program.", > version = "0.1", > executables = [Executable("program.py")] > ) > > The error: > > running build > running build_exe > creating directory build\exe.win32-3.1 > copying C:\Python31\lib\site-packages\cx_Freeze\bases\Console.exe -> > build\exe.w > in32-3.1\program.exe > copying C:\WINDOWS\system32\python31.dll -> build\exe.win32-3.1\python31.dll > Traceback (most recent call last): > File "setup.py", line 13, in <module> > executables = [Executable("program.py")] > File "C:\Python31\lib\site-packages\cx_Freeze\dist.py", line 359, in setup > distutils.core.setup(**attrs) > File "C:\Python31\lib\distutils\core.py", line 149, in setup > dist.run_commands() > File "C:\Python31\lib\distutils\dist.py", line 919, in run_commands > self.run_command(cmd) > File "C:\Python31\lib\distutils\dist.py", line 938, in run_command > cmd_obj.run() > File "C:\Python31\lib\distutils\command\build.py", line 128, in run > self.run_command(cmd_name) > File "C:\Python31\lib\distutils\cmd.py", line 315, in run_command > self.distribution.run_command(command) > File "C:\Python31\lib\distutils\dist.py", line 938, in run_command > cmd_obj.run() > File "C:\Python31\lib\site-packages\cx_Freeze\dist.py", line 231, in run > freezer.Freeze() > File "C:\Python31\lib\site-packages\cx_Freeze\freezer.py", line 470, in Freeze > > self._FreezeExecutable(executable) > File "C:\Python31\lib\site-packages\cx_Freeze\freezer.py", line 160, in _Freez > eExecutable > self._AddVersionResource(exe.targetName) > File "C:\Python31\lib\site-packages\cx_Freeze\freezer.py", line 105, in _AddVe > rsionResource > stamp(fileName, versionInfo) > File "C:\Python31\lib\site-packages\win32\lib\win32verstamp.py", line 157, in > stamp > vs = VS_VERSION_INFO(vmaj, vmin, vsub, vbuild, sdata, vdata, is_debug, is_dl > l) > File "C:\Python31\lib\site-packages\win32\lib\win32verstamp.py", line 105, in > VS_VERSION_INFO > result = pad32(result) + StringFileInfo(sdata) + VarFileInfo(vdata) > File "C:\Python31\lib\site-packages\win32\lib\win32verstamp.py", line 83, in S > tringFileInfo > result = pad32(result) + StringTable('040904E4', data) > File "C:\Python31\lib\site-packages\win32\lib\win32verstamp.py", line 75, in S > tringTable > result = result + String(k, v) > File "C:\Python31\lib\site-packages\win32\lib\win32verstamp.py", line 65, in S > tring > result = struct.pack('hh', len(value)/2, 1) # wValueLength, wType > struct.error: required argument is not an integer
At first glance this seems to have something to do with PEP 238: http://www.python.org/dev/peps/pep-0238/ It looks to me like a bug in win32\lib\win32verstamp.py, but it seems unlikely that you would be the first to find it since the division operator has been like that since the first version of Python 3.0 :) So I don't know what's going on, but thought it'd mention PEP 238. You might try changing: result = struct.pack('hh', len(value)/2, 1) # wValueLength, wType to: result = struct.pack('hh', len(value)//2, 1) # wValueLength, wType in win32verstamp.py to see if that fixes it. P.S. I haven't used Python 3.x yet and don't have it installed anywhere. -- Michael Wood <[email protected]> ------------------------------------------------------------------------------ Gaining the trust of online customers is vital for the success of any company that requires sensitive data to be transmitted over the Web. Learn how to best implement a security strategy that keeps consumers' information secure and instills the confidence they need to proceed with transactions. http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ cx-freeze-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cx-freeze-users
