Hi,
does anybody know how I can get py2exe to work with wxPython's
wxCalendarCtrl?
Currently, I have just a "standard" setup.py, and py2exe gives me a
syntax error.
Do I need to include any special extension and how?
Below is the output I get as well as a small demo app to reproduce the
problem.
I'm using python 2.2.3, wxPython 2.4.0.7, py2exe 0.4.1
TIA
/Stefan.
P.S. Things work fine without the calendar control (but I need it ;)
---error message---
E:\python\test1>f:\win1_expand\python\python.exe setup.py py2exe
running py2exe
running build
running build_scripts
not copying wxApp1.py (up-to-date)
running install_scripts
not copying build\scripts-2.2\wxApp1.py (output up-to-date)
+----------------------------------------------------
| Processing script wxApp1.py with py2exe-0.4.1
+----------------------------------------------------
Searching modules needed to run 'wxApp1.py' on path:
['E:\\python\\test1\\build\\bdist.win32\\winexe\\li b\\win1_expand\\python\\Lib\\
site-packages', '', 'E:\\python\\test1',
'f:\\win1_expand\\python\\DLLs', 'f:\\w
in1_expand\\python\\lib', 'f:\\win1_expand\\python\\lib\\lib-tk',
'f:\\win1_expa
nd\\python', 'f:\\win1_expand\\python\\lib\\site-packages']
Traceback (most recent call last):
File "setup.py", line 7, in ?
scripts = ["wxApp1.py"],
File "f:\win1_expand\python\lib\distutils\core.py", line 138, in setup
dist.run_commands()
File "f:\win1_expand\python\lib\distutils\dist.py", line 902, in
run_commands
self.run_command(cmd)
File "f:\win1_expand\python\lib\distutils\dist.py", line 922, in
run_command
cmd_obj.run()
File "F:\WIN1_E~1\python\Lib\site-packages\py2exe\build_exe.py", line
590, in
run
mf.run_script(script)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
114, in run_script
self.load_module('__main__', fp, pathname, stuff)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
282, in load_module
self.scan_code(co, m)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
339, in scan_code
self._safe_import_hook(name, m, fromlist)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
297, in _safe_import_hook
self.import_hook(name, caller)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
126, in import_hook
q, tail = self.find_head_package(parent, name)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
168, in find_head_package
q = self.import_module(head, qname, parent)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
252, in import_module
m = self.load_module(fqname, fp, pathname, stuff)
File
"F:\WIN1_E~1\python\Lib\site-packages\py2exe\tools\modulefinder.py", line
267, in load_module
co = compile(fp.read()+'\n', pathname, 'exec')
File "<string>", line 27
self.calend = wxCalendarCtrl(self, -1, pos = (20,25))
^
SyntaxError: invalid syntax
---code--
#Boa:Frame:wxFrame1
from wxPython.wx import *
from wxPython.gizmos import *
from wxPython.calendar import wxCalendarCtrl
def create(parent):
return wxFrame1(parent)
[wxID_WXFRAME1] = map(lambda _init_ctrls: wxNewId(), range(1))
class wxFrame1(wxFrame):
def _init_utils(self):
# generated method, don't edit
pass
def _init_ctrls(self, prnt):
# generated method, don't edit
wxFrame.__init__(self, id=wxID_WXFRAME1, name='', parent=prnt,
pos=wxPoint(285, 318), size=wxSize(721, 394),
style=wxDEFAULT_FRAME_STYLE, title='wxFrame1')
self._init_utils()
self.SetClientSize(wxSize(713, 367))
def __init__(self, parent):
self._init_ctrls(parent)
self.calend = wxCalendarCtrl(self, -1, pos = (20,25))
---setup.py---
from distutils.core import setup
import py2exe
setup(name = 'test1',
version = '0.1',
scripts = ["wxApp1.py"],
)