If I use the interactive window first to import wx everything works
just fine!
Anybody know what I've got set up wrong?
Ver 2.4
F:\movpy-2.0.0-py2.4.4\movpy\new.py:1: DeprecationWarning: The
wxPython compatibility package is no longer automatically generated or
activly maintained. Please switch to the wx package as soon as
possible.
Traceback (most recent call last):
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\pythonwin\pywin\framework
\scriptutils.py", line 310, in RunScript
File "F:\movpy-2.0.0-py2.4.4\movpy\guage trial.py", line 4, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wx
\__init__.py", line 45, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wx
\_core.py", line 5, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\new.py", line 1, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\__init__.py", line 15, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\_wx.py", line 3, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\_core.py", line 22, in ?
AttributeError: 'module' object has no attribute '_core'
Sorry for the late reply, I've been away. Can you show me the snippet of
code that actually causes the error please.
Thanks
Michael Foord
for example a small bit from the wxPython Docs...
import wxPython
******************************************************************************
class MainWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,wx.ID_ANY,title,size = (400,200),
style = wx.DEFAULT_FRAME)
self.control = ex.TextCtrl(self,1,style = wx.TE_MULTILINE)
self.Show(True)
app = wx.PySimpleApp()
frame = MainWindow(None,-1,"Small Editor")
app.MainLoop()
****************************************************************************************************
however, if i import wx from the interactive window, everything works
great... and continues to do so until I close the IDE.
***************************************************************
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title)
panel = wx.Panel(self, -1)
vbox = wx.BoxSizer(wx.VERTICAL)
self.Centre()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, 'cj.py')
frame.Show(True)
return True
app = MyApp(0)
app.MainLoop()
**********************************************************
returns the same error code:
>>> F:\movpy-2.0.0-py2.4.4\movpy\new.py:1: DeprecationWarning: The wxPython compatibility package is no longer automatically generated or activly maintained. Please switch to the wx package as soon as possible.
Traceback (most recent call last):
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\pythonwin\pywin\framework
\scriptutils.py", line 310, in RunScript
File "F:\movpy-2.0.0-py2.4.4\movpy\sizerexperiments.py", line 1,
in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wx
\__init__.py", line 45, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wx
\_core.py", line 5, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\new.py", line 1, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\__init__.py", line 15, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\_wx.py", line 3, in ?
File "F:\movpy-2.0.0-py2.4.4\movpy\lib\wx-2.8-msw-unicode\wxPython
\_core.py", line 22, in ?
AttributeError: 'module' object has no attribute '_core'
Once again, if then enter "import wx" into the interactive window it
imports correctly. I can the run the script until I close the IDE.
Hmmm....
When I run that code (from Pythonwin or directly with Movable Python), I
see a window and no deprecation warning.
Very odd. I can see from the traceback that it is using the
'wx-2.8-msw-unicode' package.
Double hmmm....
Line 5 in core.py is 'import new'. You have a 'new.py' module in your
movpy directory (or at least that is the line that appears in the
traceback) - which for some reason could be importing wxPython...
It should be using the standard library new module instead. Could this
be the problem ?
Michael
Cheers...
Canuckelhead