[Tutor] Running a script from another folder
W W
srilyk at gmail.com
Wed Nov 12 18:21:55 CET 2008
On Wed, Nov 12, 2008 at 10:27 AM, <ycbh7f302 at sneakemail.com> wrote:
> Suppose I have a python script in /usr1/myID/bin and I want to run it from
> another folder. If I enter
>
> python ~myID/bin/myscript
>
> that works. Is there a way to get by with
>
> python myscript
>
> or even
>
> myscript.py
>
> I've tried specifying the PYTHONPATH
> environmental variable but it seems to be used only for importing modules
it looks like you're on linux - so at the beginning of your script put
#!/usr/bin/env python (I believe) and then chmod +x myscript.py
then you can call it from the command line.
Alternatively you could create a shell script that would execute it with
python.
HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081112/f95bb203/attachment.htm>
More information about the Tutor
mailing list