Run Python script in command line

Paul Simmonds psimmo60 at hotmail.com
Fri Dec 13 04:44:08 EST 2002


Reid Lai <reidlai at reidlai.com> wrote in message news:<3DF8B24C.7080806 at reidlai.com>...
> Dear All,
> 
> I am newbie of Python and  have installed Python 2.2 and wxPython.  When 
> I run "python.exe test.py", an error about MainLoop is not an attribute 
> of "NoneType".  While running "pythonw.exe test.py", nothing comes up. 
> Everything works fine under pyShell.  Is there any idea?
> 
> My test.py is as follow:
> 
> import os, sys
> from wxPython.wx import *
> 
> def MyApp(wxApp):
This ^ may be your problem. I think you mean:
  class MyApp(wxApp):

I'm assuming you want to subclass wxApp. At the moment, MyApp is a
function taking wxApp as an argument.

However, if this was the case, I'm fairly certain it wouldn't work
anywhere. Are you sure it was working as expected in pyShell?

HTH,
Paul

>    def OnInit(self):
>      mainWindow = wxFrame(NULL, -1, "Testing")
>      mainWindow.Show(true)
>      self.setTopWindow(mainWindow)
>      return true
> 
> app = MyApp(0)
> app.MainLoop()
> 
> Regards,
> 
> Reid Lai



More information about the Python-list mailing list