I've tested rurple1.0rc3, running on amd64 Gentoo/Linux, with Python 2.5.2
and wxPython 2.8.9.1.
When clicking at "Load robot images" button, or even when trying to close
the window after changing something, I get:
NameError: global name 'os' is not defined
After some digging, I found the cause of this problem. Somehow (probably a
bug in wxpython), the following line removes 'os' from global scope:
win = py.shell.Shell(self.window, -1, introText = "")
I've added "print os.getcwd()" before and after that line, and I receive
NameError exception at the print right after that line.
I've also looked at globals() dictionary before and after that line, and
the only changes are the removal of 'os' module and the addition of 'shell'
module.
Unfortunately, the solution is not simple. Just adding "import os" line
after the py.shell.Shell won't work. Upon doing that, I got the following
message at the terminal, when I clicked on"Load robot images" button:
> /tmp/software/rurple1.0rc3/rur_start.py(495)load_images()
-> pdb.post_mortem(sys.exc_info()[2])
What's more, if I use ipython (version 0.9.1) instead of python, by running
"ipython rur_start.py", then I don't get that NameError exception anymore,
and the global namespace is not changed after execution of that
py.shell.Shell line (I've compared the globals() output before and after
that line). This is weird, as ipython is just an interactive shell and
shouldn't have changed the behavior of the program.
There is a workaround. If I type "import os" inside the python shell (at
the third tab), then everything works.
I suppose it might be a bug within wxpython. Maybe people from wxpython
community might understand what's going on here.
Nobody/Anonymous
None
None
Public
Copyright © 2009 Geeknet, Inc. All rights reserved. Terms of Use