[Tutor] i can't for the life of me get "#! /usr/bin/env python" or "#!/usr/bin/python" to work

vince spicer vinces1979 at gmail.com
Wed Oct 21 20:36:22 CEST 2009


On Wed, Oct 21, 2009 at 12:33 PM, vince spicer <vinces1979 at gmail.com> wrote:

>
>
> On Wed, Oct 21, 2009 at 12:31 PM, vince spicer <vinces1979 at gmail.com>wrote:
>
>>
>>
>> On Wed, Oct 21, 2009 at 12:21 PM, Jason Willis <chaoticslacker at gmail.com>wrote:
>>
>>> hi everyone,
>>>
>>> sorry for the rather boring question but i'm having serious issues
>>> getting my programs to run from the command line without having to type
>>> "python" in-front of them. I've tried a lot of different variations on the
>>> #!/usr/bin/ etc. line and have come up with the following every time:
>>>
>>> *[root at localhost moonshinerat]# mycode.py
>>> bash: mycode.py: command not found
>>> [root at localhost moonshinerat]# mycode
>>> bash: mycode: command not found
>>> [root at localhost moonshinerat]#
>>>
>>> I've chmod'ed the program and everything but i still get command not
>>> found from the shell. The only thing that does work is ./mycode.py but from
>>> what i understand that's been built into linux itself to work that way...
>>>
>>> please someone let me know what i'm doing wrong here and possibly help??
>>>
>>> thanks!
>>>
>>> *
>>> _______________________________________________
>>> Tutor maillist  -  Tutor at python.org
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
>> try:
>>
>> ./mycode.py
>>
>> since i'm guess your current path isn't in the system path
>>
>> Vince
>>
>>
> Sorry didn't read full post,
>
> you would have add your program directory to the system path in order to
> call the program by name
>
> you can add this to you bashrc
>
> export PATH=~/my/program/dir:"${PATH}"
>
>
> Vince
>

A better description of linux PATH:

http://www.linuxheadquarters.com/howto/basic/path.shtml
http://www.linfo.org/path_env_var.html

Vince
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091021/2879c470/attachment.htm>


More information about the Tutor mailing list