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

Mark Doukidis mdoukidis at gmail.com
Wed May 17 03:15:11 CEST 2006

Try using "sitecustomize.py". This is the setup I used for Python2.3:

# sitecustomize.py to be placed in python library directory.
import os
import sys

if os.name == 'ce':
  sys.path.append("\My Documents\Personal")

Hope this is useful.

Mark Doukidis

On 5/17/06, Bandung <bandung at skyesystems.com> wrote:
> 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.
> Why?
> (1. This doesn't work)
> >>>import paths
> The paths.py file is sitting in the Python24\Lib  directory and contains the
> following,
> -------
> #paths.py
> # 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.
> _______________________________________________
> PythonCE mailing list
> PythonCE at python.org
> http://mail.python.org/mailman/listinfo/pythonce

More information about the PythonCE mailing list