[Tutor] Defining & Importing Functions

James.Rocks@equant.com James.Rocks@equant.com
Mon, 21 Oct 2002 11:06:58 +0100


Hi again,

Still trying to resolve this one.

O/S:        Windows XP
Python Inst:      c:\Python21
IDE Inst (Boa):   c:\boa
Prog Dir:   c:\Python21\CTX (not on path or in PYTHONPATH variable)
New Prog Dir:     c:\boa\Projects\CTX  (not on path but IS in PYTHONPATH
variable)

When I run my program from the original program folder (where I developed
it) it's fine. When I run it (or any other python program) from a new
folder (a subfolder of c:\boa) I get:

>>> execfile("c:\boa\Projects\CTX\ctxrept.py")
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
IOError: [Errno 22] Invalid argument
>>>

In neither case is the program in the same folder as the python program and
a further test I've done indicates that if I run the program from another
folder (c:\Python21\Projects\CTX) it also works implying that Python (on
Windows at any rate) must be either in the same folder or a parent folder
of the project.

Perhaps the answer is to re-install boa as a subfolder of c:\Python21 but I
really feel that it shouldn't matter where I run my program from, it should
just pick up the executable and "run with it"!

James

James C. Rocks
Equant
Archway House
Canary Wharf
London E14 9SZ