[PythonCE] Can't Get My Import Module Command to Work Properly

Bandung bandung at skyesystems.com
Tue May 16 23:42:08 CEST 2006

Using the PythonCE interactive window, I am trying to shortcut having to type
in a sys.path.append() command every time I want to run a python script that
is not in the standard path.  So I created a module called paths.py with
several sys.path.append commands in it.

When I import this module into the interpreter, the interpreter appears to
accept it with no errors.  However, I can't run any python scripts that are
within the new paths that my append() commands define.

If I fire up a python shell interpretor and type these two commands - the
sys.path.append() command and then type another command line like ... from
"new_module" import * this works.  But if I put them in a module called
"paths" and import that module into my interpreter session, it doesn't work. 

(1. This doesn't work)
>>>import paths

The paths.py file is sitting in the Python24\Lib  directory and contains the
# append this path to system path
import sys
sys.path.append("\My Documents\Personal")
from calctaxes import *
No such module "calctaxes" error results.

The use of any functions within calctaxes fails even though the file
calctaxes.py sits in the directory \My Documents\Personal

(2. But this works if I type the following into the interpreter...

>>>import sys
>>>sys.path.append("\My Documents\Personal")
>>>from calctaxes import *

Then all of my functions within calctaxes work from the interpreter.
View this message in context: http://www.nabble.com/Can%27t-Get-My-Import-Module-Command-to-Work-Properly-t1631521.html#a4419614
Sent from the Python - pythonce forum at Nabble.com.

More information about the PythonCE mailing list