wxpython ... wx

70 views
Skip to first unread message

Canuckelhead

unread,
Sep 2, 2007, 12:59:45 PM9/2/07
to Movable Python
When I run a script and use "import wx"
I get problems... It seems to be importing the older wxPython...
I get the deprication warning and then a bunch of problems...

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

Canuckelhead

unread,
Sep 2, 2007, 4:59:29 PM9/2/07
to Movable Python
The error message I get is

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'


Michael Foord

unread,
Sep 2, 2007, 5:01:40 PM9/2/07
to mo...@googlegroups.com
Hello chap,

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

Canuckelhead

unread,
Sep 2, 2007, 5:30:21 PM9/2/07
to Movable Python
anything with import wx has the same issue

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.

Canuckelhead

unread,
Sep 2, 2007, 6:45:15 PM9/2/07
to Movable Python
Oops that code was no good.
here is a better example...

***************************************************************
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.

Michael Foord

unread,
Sep 3, 2007, 6:28:22 PM9/3/07
to mo...@googlegroups.com
Hello,

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

Canuckelhead

unread,
Sep 4, 2007, 12:45:28 AM9/4/07
to Movable Python
Yes.. I do infact have an old module in there with the name new.py and
it does, of course, import wxPython.
That was really foolish of me. And that solves it. Thank you for the
fast help. I really should have seen that right at the beginning of
the deprication warning.

Cheers...
Canuckelhead

Reply all
Reply to author
Forward
0 new messages