wx: PyNoAppError

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • SuperHik

    #1

    wx: PyNoAppError

    Hi!

    Using XP SP2, PythonWin 2.4.3, any trying to use wx 2.6.3.2
    When using wx, the first time I run a script it runs fine.
    Second time, it rasises an error:

    [Script]*************** *************** ****
    import wx
    app = wx.App()
    win = wx.Frame(None, title="Simple Editor")
    win.Show()
    app.MainLoop()

    [Error]*************** *************** *****
    Traceback (most recent call last):
    File
    "C:\Python24\Li b\site-packages\python win\pywin\frame work\scriptutil s.py",
    line 310, in RunScript
    exec codeObject in __main__.__dict __
    File "C:\Python24\my stuff\ool.pyw", line 3, in ?
    win = wx.Frame(None, title="Simple Editor")
    File "C:\Python24\Li b\site-packages\wx-2.6-msw-ansi\wx\_window s.py",
    line 493, in __init__
    newobj = _windows_.new_F rame(*args, **kwargs)
    PyNoAppError: The wx.App object must be created first!
    *************** *************** ************

    So this happens no matter what the script is.
    And it always occurs on the first line a new widget is created.
    This is not a problem with the script, because it does the same
    thing on every script I copied from the internet. It must be a
    wx bug, but has anyone fixed it?
    I googled and only found this:


    *Not helpful

    *Says that runnig the script outside of IDLE fixes the problem.
    That works for me too but if there is a way to run it from IDLE
    that would be much easier.

    Any experience on this?
  • Scott David Daniels

    #2
    Re: wx: PyNoAppError

    SuperHik wrote:

    (1) A wxPython question. Better to ask on the wxPython newsgroup
    (listed as comp.python.wxp ython on gmane).
    [color=blue]
    > Using XP SP2, PythonWin 2.4.3, any trying to use wx 2.6.3.2
    > When using wx, the first time I run a script it runs fine.
    > Second time, it rasises an error: ....[/color]
    Up here you should have mentioned you are doing this in IDLE, that is
    your problem.

    Later in your message you say:[color=blue]
    > ... *Says that runnig the script outside of IDLE fixes the problem.
    > That works for me too but if there is a way to run it from IDLE
    > that would be much easier.[/color]

    This is the inevitable result of running a pair of GUIs simultaneously:
    They both want control of the main program to run their idle loop, and
    only can win.

    --Scott David Daniels
    scott.daniels@a cm.org

    Comment

    • SuperHik

      #3
      Re: wx: PyNoAppError

      Scott David Daniels wrote:[color=blue]
      > SuperHik wrote:
      >
      > (1) A wxPython question. Better to ask on the wxPython newsgroup
      > (listed as comp.python.wxp ython on gmane).[/color]
      I'm aware it's a wxPython question but I wasn't aware
      of the group you mentioned. Thank you!
      [color=blue]
      >[color=green]
      >> Using XP SP2, PythonWin 2.4.3, any trying to use wx 2.6.3.2
      >> When using wx, the first time I run a script it runs fine.
      >> Second time, it rasises an error: ....[/color]
      > Up here you should have mentioned you are doing this in IDLE, that is
      > your problem.
      >
      > Later in your message you say:[color=green]
      >> ... *Says that runnig the script outside of IDLE fixes the problem.
      >> That works for me too but if there is a way to run it from IDLE
      >> that would be much easier.[/color]
      >
      > This is the inevitable result of running a pair of GUIs simultaneously:
      > They both want control of the main program to run their idle loop, and
      > only can win.[/color]
      I wasn't running them simultaneously. I ended the first (and only) one
      and then tried to start it again.[color=blue]
      >
      > --Scott David Daniels
      > scott.daniels@a cm.org[/color]

      Comment

      Working...