Another ArtProvider problem

Back in Dec, 2010, I had an issue with a custom Art Provider. I know I had this thing working before, but now I’m getting a stream of errors and I can’t figure out where they’re coming from. I have a bunch of image files in a sub-directory, and this ArtProvider is supposed to use an image name and convert to a bitmap. I’ve copied the attached code directly form the Demo.

This is on Windows 7, Python 2.7.2 and wxPython 2.8.12.

I get wx._core.PyNoAppError: The wx.App object must be created first!

The funny thing is, the window pops up and shows me the correct image. I have to go into Task Manager and stop the python.exe process. (It doesn’t show up as an app.)

I’ve rebooted my system, and this error persists.

The traceback doesn’t go deep enough to tell me which line in my file is causing the problem:

Traceback (most recent call last):

File “C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_misc.py”, line 1358, in Notify

self.notify()

File “C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py”, line 14771, in Notify

self.result = self.callable(*self.args, **self.kwargs)

File “C:\Users\Josh\AppData\Roaming\PyScripter\remserver.py”, line 136, in periodicCall

self.calllater.Restart()

File “C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_core.py”, line 14721, in Start

self.timer = wx.PyTimer(self.Notify)

File “C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_misc.py”, line 1353, in init

Timer.init(self)

File “C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx_misc.py”, line 1296, in init

misc.Timer_swiginit(self,misc.new_Timer(*args, **kwargs))

wx._core.PyNoAppError: The wx.App object must be created first!

Traceback (most recent call last):

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py”, line 90, in getattribute

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py”, line 45, in syncreq

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py”, line 343, in sync_request

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py”, line 305, in serve

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py”, line 265, in _recv

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\channel.py”, line 36, in recv

File “C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\stream.py”, line 105, in read

EOFError: [Errno 10054] An existing connection was forcibly closed by the remote host

Could one of you wise guru’s take a peek? What could be causing this?

ArmstrongArtProvider.py (1.95 KB)

armstrong_bw.zip (67.3 KB)

···


Josh English

Joshua.R.English@gmail.com
http://www.joshuarenglish.com

Back in Dec, 2010, I had an issue with a custom Art Provider. I know I
had this thing working before, but now I'm getting a stream of errors
and I can't figure out where they're coming from. I have a bunch of
image files in a sub-directory, and this ArtProvider is supposed to use
an image name and convert to a bitmap. I've copied the attached code
directly form the Demo.

This is on Windows 7, Python 2.7.2 and wxPython 2.8.12.

I get wx._core.PyNoAppError: The wx.App object must be created first!

The funny thing is, the window pops up and shows me the correct image. I
have to go into Task Manager and stop the python.exe process. (It
doesn't show up as an app.)

I've rebooted my system, and this error persists.

The traceback doesn't go deep enough to tell me which line in my file is
causing the problem:

Because it probably isn't in your code. See below.

Traceback (most recent call last):
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 1358, in Notify
     self.notify()
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 14771, in Notify
     self.result = self.callable(*self.args, **self.kwargs)
   File "C:\Users\Josh\AppData\Roaming\PyScripter\remserver.py", line
136, in periodicCall
     self.calllater.Restart()
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 14721, in Start
     self.timer = wx.PyTimer(self.Notify)
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 1353, in __init__
     Timer.__init__(self)
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_misc.py",
line 1296, in __init__
     _misc_.Timer_swiginit(self,_misc_.new_Timer(*args, **kwargs))
wx._core.PyNoAppError: The wx.App object must be created first!
Traceback (most recent call last):
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py",
line 90, in __getattribute__
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\netref.py",
line 45, in syncreq
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py",
line 343, in sync_request
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py",
line 305, in serve
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\protocol.py",
line 265, in _recv
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\channel.py",
line 36, in recv
   File
"C:\Users\Josh\Documents\PyScripter\Lib\rpyc-python2x.zip\rpyc\core\stream.py",
line 105, in read
EOFError: [Errno 10054] An existing connection was forcibly closed by
the remote host

Could one of you wise guru's take a peek? What could be causing this?

Try running it directly from the command line without PyScripter. I expect that it will work fine in that case. It looks to me like the problem is that something (PyScripter's remote procedure call?) is using wx.CallLater before the application object is created, and since that is a subclass of wx.Timer and timers are not valid before the UI libraries are fully initialized then it throws an error.

···

On 6/2/12 9:04 PM, Josh English wrote:

--
Robin Dunn
Software Craftsman

Hey, that works just fine, and importing this art provider into other scripts and running them works, even in PyScripter.

That’s some deep juju I just don’t get.

Thanks.

···

On Mon, Jun 4, 2012 at 10:15 AM, Robin Dunn robin@alldunn.com wrote:

Because it probably isn’t in your code. See below.

Try running it directly from the command line without PyScripter. I expect that it will work fine in that case. It looks to me like the problem is that something (PyScripter’s remote procedure call?) is using wx.CallLater before the application object is created, and since that is a subclass of wx.Timer and timers are not valid before the UI libraries are fully initialized then it throws an error.


Josh English
Joshua.R.English@gmail.com
http://www.joshuarenglish.com