newbie questions about sys.path, wxpython, IDLE and pythonwin
Robin Dunn
robin at alldunn.com
Thu Jul 15 00:45:16 EDT 1999
More information about the Python-list mailing list
Thu Jul 15 00:45:16 EDT 1999
- Previous message (by thread): newbie questions about sys.path, wxpython, IDLE and pythonwin
- Next message (by thread): PIL+Tkinter query (I must be doing something _really_ stupid)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
MB <ritm at gnet.tn> wrote in message news:378B7A69.12874AAC at gnet.tn... > Then I > tried the same thing through the IDLE GUI and received this error: > ------------------ > Traceback (innermost last): > File "C:\PROGRA~1\PYTHON\TOOLS\IDLE\ScriptBinding.py", line 131, in > run_module_event > execfile(filename, mod.__dict__) > File "C:\Program Files\Python\wxPython\demo\demo.py", line 3, in ? > import Main > ImportError: No module named Main > ----------------- > > Obviously it was a problem of path. Since demo.py imports things in the same directory where demo.py lives, it should be found by default. Perhaps IDLE is masking this path feature somehow? What is the CWD when executing from an edit buffer? > So I added the directory an its > subdirectories to sys.path and tried again. I received this > > --------------------------------- > Traceback (innermost last): > File "C:\PROGRA~1\PYTHON\WXPYTHON\DEMO\Main.py", line 186, in > OnSelChanged > self.GetDemoFile('Main.py') > File "C:\PROGRA~1\PYTHON\WXPYTHON\DEMO\Main.py", line 221, in > GetDemoFile > except IOException: > NameError: IOException > Traceback (innermost last): > File "C:\PROGRA~1\PYTHON\WXPYTHON\DEMO\Main.py", line 186, in > OnSelChanged > self.GetDemoFile('Main.py') > File "C:\PROGRA~1\PYTHON\WXPYTHON\DEMO\Main.py", line 221, in > GetDemoFile > except IOException: > NameError: IOException > --------------------------------- The demo expects that its current working directory is where the demo.py lives. It tries to open files there. > > Other thing. I examined demo.py through the debugger under pythonwin I > found this statement: > 'import miscc' > The interpreter import this module but is not able to locate it. When I > type >>> miscc it says that is a built-in module. Are there modules that > are not python files ? What is a built-in module ? I didn't find its > definition in the docs. The miscc module, and about a dozen others are Python extension modules written in C++. Most of them live in wxc.pyd and are initialized when the wxc module is imported. Since it is not written in Python, it's a bit hard for the debugger to trace into it. You can read more about extension modules in the "Extending and Embedding" document at http://www.python.org/doc/ Also, the wxPython sources can be downloaded and you can browse the C++ code to your hearts content. On the other hand since I (the author) don't even like reading it you might not want to. It's generated by SWIG and is fairly ugly. > Last question. About the syntaxic ':' at the end of a line when it > begins with def, class,if ,when,etc... Is it absolutely necessary for > the language ? Yep. The ":" is what keeps the def, class, if, when, etc. from falling off the end of the line. <grin> -- -- Robin Dunn robin at AllDunn.com http://AllDunn.com/robin/ http://AllDunn.com/wxPython/ Check it out! Try http://AllDunn.com/laughworks/ for a good laugh.
- Previous message (by thread): newbie questions about sys.path, wxpython, IDLE and pythonwin
- Next message (by thread): PIL+Tkinter query (I must be doing something _really_ stupid)
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list