0

OI am using cx_freeze on CentOS6 (via Bash) and when I do "Python setup.py build" I get this error:

$ python setup.py build
File "setup.py", line 11
options=['build_exe':{'excludes':excludes, 'packages':packages, 'include_files':includefiles}]
                    ^
SyntaxError: invalid syntax

Here's my setup.py:

import sys
from cx_Freeze import setup, Executable

includefiles = ['cpu.py']
includes = ['psutil', 'time', 'socket']
excludes=[]
packages=[]
setup(name='CPU Stats',
 version='0.1',
  description='Script to pull CPU Stats',
  options=['build_exe':{'excludes':excludes, 'packages':packages, 'include_files':includefiles}]
  executables=[Executable('cpu.py')]
 )

'Cpu.py" is the script I want to bundle. "psutil", "time", "socket" are Python modules.

For my setup.py, I used [this]cx_Freeze and Python 3.3 by @Slobodan Stevic

Community
  • 1
  • 1
askance
  • 1,077
  • 4
  • 14
  • 19

1 Answers1

1

Edited according to Thomas K comment:

According to the docs, the syntax for the options is:

options={'build_exe':{'excludes':excludes, ... i.e. use a dictionary, not a list.

Felix Zumstein
  • 6,737
  • 1
  • 30
  • 62
  • Thx @Felix Zumstein ! However, now I am getting a different error - -bash: cxfreeze: command not found - but my Python has cx_Freeze in site-packages. Further, I have another question about using cxf in OSX here --- http://stackoverflow.com/questions/18598147/error-in-cx-freeze-build – askance Sep 03 '13 at 17:55
  • if you start Python and run `import cx_Freeze`, what happens?, i.e. `$python`, then `>>> import cx_Freeze` – Felix Zumstein Sep 03 '13 at 18:39
  • @FelixZumstein : That answer isn't quite right. The docs example declares `build_exe_options`, but then passes it in as `options = {"build_exe": build_exe_options},`. The problem here is using square brackets where it needs `{}` brackets to make another dictionary. – Thomas K Sep 03 '13 at 22:52
  • @ThomasK: oh wow, that must have gone a little to fast. corrected now. – Felix Zumstein Sep 04 '13 at 06:03