1

I have been learning Python2.7 for a little bit now. I'm using Windows 7 64 bit BTW. I started learning GUI's and have been trying to use wxpython and IDLE for this. So I type out some code:

import wx
app = wx.App()
win = wx.Frame(None)
win.Show()
app.MainLoop()

I run the program, and the window pops up, but the blue doughnut is there. I try to close the window, and it says that pythonw.exe is not responding. Another window pops up about wxpython. It says:

wxPython stdout/stderr(Not Responding)

Traceback (most recent call last):
**IDLE Internal Exception:
File "C:\Python27\lib\idlelib\run.py", line 93, in main
seq, request = rpc.request_queue.get(block=True, timeout=0.05)
File "C:\Python27\lib\Queue.py", line 177, in get
self.not_empty.wait(remaining)
File "C:\Python27\lib\threading.py", line 263, in wait
_sleep(delay)
typeError: 'int' object is not callable

What is wrong and how do I fix it?

Thanks.

Joshua Malott
  • 13
  • 1
  • 3

2 Answers2

2

The crash is most likely happening at the point when you try and start the event loop. See this bug report: http://bugs.python.org/issue989712

Seems someone else has gone as far to try and create an extension to handle this ability: http://idlex.sourceforge.net/extensions.html

Basically, don't do this from IDLE. Write a script and run it from the shell or the script directly if in windows, by naming it with a .pyw extension and double clicking it. There is apparently a conflict between IDLE's own event loop and the ones from GUI toolkits.

jdi
  • 90,542
  • 19
  • 167
  • 203
  • The EventLoop.py extension from IdleX allows the wx toolkit to run without calling app.Mainloop(). – Roger Apr 13 '12 at 22:56
0

It seems that something might be polluting variables in the threading library, it looks like _sleep variable is being overwritten with an int value; in which case _sleep(x) will not work since _sleep is an int and ints are not callable.

It may be in your client code or in some framework code or libraries you are importing. Is that all of the code?

Try running this code from a plain python terminal, not from an IDE like IDLE.

Preet Kukreti
  • 8,417
  • 28
  • 36