[Tutor] python scripting using "./"

Wolf Halton wolf.halton at gmail.com
Wed May 25 12:23:10 CEST 2011


An oddity of the PATH variable in Linux (or at least Ubuntu) is that there
is a folder in PATH called /home/~/bin.  The ~ is replaced with your profile
name.  If you create that folder and put the file into it, you can invoke it
from anywhere in the filesystem with just its name.

On Tue, May 24, 2011 at 10:39 AM, Walter Prins <wprins at gmail.com> wrote:

> Hi Hank,
>
> On 24 May 2011 15:15, Hank Wilkinson <hwilkinson at triad.rr.com> wrote:
>
>> Yes, I would love to know why it doesn't work, or what I'm doing wrong.
>>
>> John-Wilkinsons-iMac:p31summerfield wilkinson$ cat hello.py
>> #!/usr/bin/env python
>>
>> print("Hello world")
>> John-Wilkinsons-iMac:p31summerfield wilkinson$ chmod +X hello.py
>> John-Wilkinsons-iMac:p31summerfield wilkinson$ ./hello.py
>> -bash: ./hello.py: Permission denied
>>
>
> OK you had me scratching my head for a couple of minutes, but then I tried
> your steps on my Ubuntu box and managed to reproduce it.
>
> The problem here is you're using +X (capital X) when setting the file
> execute permission.  You should be using +x (lowercase x) when setting the
> script to be executable.  Capital X will only set the file to be executable
> if it's **already** executable for some other user/group (which is not the
> case in your new script's case.)  Lowercase x will set it executable full
> stop.
>
> Cheers
>
> Walter
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
This Apt Has Super Cow Powers - http://sourcefreedom.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110525/3f4a54be/attachment.html>


More information about the Tutor mailing list