newbie questions about sys.path, wxpython, IDLE and pythonwin

MB ritm at gnet.tn
Tue Jul 13 13:42:02 EDT 1999


I need to know exactly how the sys.path is built. In my system I have no
pythonpath variable but the sys.path returns a list. I suppose it was
built by default. This list doesn't contain all my python
subdirectories. So I want to know when and how this list was built ?
(yes I examined the registry and found references to python directories
but they don't match my sys.path)
Another question in relation with the first. I downloaded wxPython an
tried to run the demo.py from the pythonwin GUI (opening
c:\wxpython\demo\demo.py and running it). It runs perfectly. 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. 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
---------------------------------

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.
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 ?
Thanks






More information about the Python-list mailing list