why i cannot invoke python script using command line?

Chris Angelico rosuav at gmail.com
Tue Aug 23 16:25:56 CEST 2011


On Tue, Aug 23, 2011 at 3:03 PM, smith jack <thinke365 at gmail.com> wrote:
> but failed when using python f:\project\src\a.py, what's wrong?
> (the error msg shows a.py cannot find b.py) , what should i do in
> order to run a.py using command line?
>

>From the sound of things, your working directory is not
f:\project\src. I recommend you either:

1) Change to that directory first:
cd f:\project\src
python a.py

Or 2) Add to your import path inside a.py:
import sys
sys.path.append(r"f:\project\src")

Either method should solve the problem.

Chris Angelico



More information about the Python-list mailing list