[Tutor] Issues In Terminal

Dave Angel davea at ieee.org
Mon Sep 27 01:16:15 CEST 2010



On 2:59 PM, Bill DeBroglie wrote:
> <snip>
>> No, I meant that you should edit your .py file and add
>> #!/usr/bin/env python
>> as the first line, THEN try to run it.
>
> BINGO!
>>
>> Right now what's happening is that you're handing a line of Python 
>> script to the shell and asking it to run it; the shell is telling you 
>> (oh-so-politely) "what the hell is this?"  You need to give it a clue.
>
> Thank you for the translation. So I need to do this with every .py 
> file? My friend who was helping me (he's only been at this a few 
> months) doesn't need to do this. Is that possible or is he just 
> misleading me?
>
>
Two times you wouldn't need such a line:

1) in Windows, where file extension determines what the shell will do 
with the file
2) when you explicitly run the script by naming the python executable, 
such as:

    python  chapter_2.py





More information about the Tutor mailing list