Run Python script in command line

John Roth johnroth at ameritech.net
Thu Dec 12 12:02:43 EST 2002


If it runs under pyShell and doesn't run at the command line,
I'd suspect that your path or PythonPath isn't set up correctly.
It's likely to be subtle because the import worked. Check where
you put the compiled objects (the .dll for wxWindows and
the interface module.)
The immediate error is because MyApp(0) is returning
a None object instead of an application object.

HTH.

John Roth

"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):
>    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