python path

Other talk about Salix
User avatar
gapan
Salix Wizard
Posts: 6353
Joined: 6. Jun 2009, 17:40

Re: python path

Post by gapan »

The losuj.py 1st line you posted in the previous page is wrong. There is no /bin/python. It's /usr/bin/python.
Image
Image
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: python path

Post by mimosa »

Aha! :idea:

But that still doesn't explain the failure of .losuj-1.py, which calls python correctly. Or does that one work now?
User avatar
ink3
Posts: 80
Joined: 9. Apr 2011, 14:16

Re: python path

Post by ink3 »

Maybe I would ask about this problem on other forums?
linuxquestions.org?
User avatar
gapan
Salix Wizard
Posts: 6353
Joined: 6. Jun 2009, 17:40

Re: python path

Post by gapan »

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!
couldn't be easier than that and no idea where you are getting confused, as you refuse to provide more information. So, yes, go to another forum, expect everyone to be a psychic and you'll magically have your problem solved.
Image
Image
User avatar
ink3
Posts: 80
Joined: 9. Apr 2011, 14:16

Re: python path

Post by ink3 »

peacefully. I thought you ran out of ideas.
gapan you make typo (mypythonscript) from the 5 row.

don't take offense.

In /tmp path your script works
But in another localization not.
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[~]$
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: python path

Post by Shador »

Is the partition mounted with noexec?
Image
User avatar
gapan
Salix Wizard
Posts: 6353
Joined: 6. Jun 2009, 17:40

Re: python path

Post by gapan »

Code: Select all

stahoo[skrypty_python]$ echo '#!/usr/bin/env python' > mypythonscript
stahoo[skrypty_python]$ echo 'print "It works!"'>> mypythonscript
stahoo[~]$ chmod +x mypythonscript
Are you aware that you're making ~/mypythonscript executable instead of making ~/skrypty_python/mypythonscript executable?
Image
Image
User avatar
ink3
Posts: 80
Joined: 9. Apr 2011, 14:16

Re: python path

Post by ink3 »

yes

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
User avatar
mimosa
Salix Warrior
Posts: 3311
Joined: 25. May 2010, 17:02
Contact:

Re: python path

Post by mimosa »

Please post the output of

Code: Select all

ls -ld /home/stahoo/skrypty_python
mount | grep root
... 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!

EDIT

All the King's horses and all the King's men ...
Last edited by mimosa on 3. Feb 2012, 20:59, edited 1 time in total.
Shador
Posts: 1295
Joined: 11. Jun 2009, 14:04
Location: Bavaria

Re: python path

Post by Shador »

ink3 wrote:yes

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
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.

Edit:
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!
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.
Image
Post Reply