Here's my problem. I wx application that works great until I close it (leaving the idle editing session open) and then restart it. Then parts of the program see variables that should be things like 'wx.panel' as PyDeadObj .... Once I restart the idle session and re-run the program it works fine. I've tried reload(wx), I've tried deleting all wx variables from sys.modules ... Any more ideas?

Here's my problem. I wx application that works great until I close it (leaving the idle editing session open) and then restart it.

Your real problem is that you're using IDLE.

Your best bet is to switch to a better-featured (not to mention better-designed) IDE and run your scripts directly using python.exe or pythonw.exe

I suggest something like PyScripter or NotePad++ (although with the latter you'll have to do your own personalization to get Python setup and have the ability to syntax check, run scripts, etc.)

I noticed before that if you work in the shell with some IDEs, then you seem to retain old variables. Check the global dictionary in the shell. I would say avoid the shell with any programs larger than 2 lines.

I appreciate both comments. I'll check out pyscripter and I'll look over the globals again. It just seems weird to me that the old variables don't get overwritten at next run.

This article has been dead for over six months. Start a new discussion instead.