Re: python path
Posted: 3. Feb 2012, 18:36
The losuj.py 1st line you posted in the previous page is wrong. There is no /bin/python. It's /usr/bin/python.
Code: Select all
$ cd /tmp
$ mkdir mydir
$ cd mydir
$ echo '#!/usr/bin/env python' > mypythonscript
$ echo 'print "It works!"'>> mypythonscript
$ chmod +x mypythonscipt
$ cd
$ PATH=$PATH:/tmp/mydir
$ mypythonscipt
It works!
stahoo[skrypty_python]$ echo '#!/usr/bin/env python' > mypythonscript
stahoo[skrypty_python]$ echo 'print "It works!"'>> mypythonscript
stahoo[~]$ chmod +x mypythonscript
stahoo[skrypty_python]$ cd
stahoo[~]$ PATH=$PATH:/home/stahoo/skrypty_python
stahoo[~]$ mypythonscript
bash: /home/stahoo/skrypty_python/mypythonscript: Permission denied
stahoo[~]$
Code: Select all
stahoo[skrypty_python]$ echo '#!/usr/bin/env python' > mypythonscript
stahoo[skrypty_python]$ echo 'print "It works!"'>> mypythonscript
stahoo[~]$ chmod +x mypythonscript
Code: Select all
$ cat /etc/fstab
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
tmpfs /dev/shm tmpfs defaults 0 0
/dev/sda2 swap swap defaults 0 0
/dev/sda1 / ext4 noatime,defaults 1 1
/dev/sda3 /home ext4 defaults,noexec 1 2
Code: Select all
ls -ld /home/stahoo/skrypty_python
mount | grep root
Well, then don't do it, or you won't be able to execute any program in that location (i.e. remove the ',noexec' part an reboot). I don't think that's a default setting for Salix anywhere.ink3 wrote:yesCode: Select all
$ cat /etc/fstab devpts /dev/pts devpts gid=5,mode=620 0 0 proc /proc proc defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 /dev/sda2 swap swap defaults 0 0 /dev/sda1 / ext4 noatime,defaults 1 1 /dev/sda3 /home ext4 defaults,noexec 1 2
Even if he got the executable permission right, which he probably did, it's definitely the noexec. I already was thinking about that one earlier but it seemed unlikely at that point, as it's nowhere default.mimosa wrote:... and as gapan just said, you need to be in the correct directory when issuing the chmod +x, or use an absolute path. I expect that's it!