|
List Info
Thread: Running Scripts
|
|
| Running Scripts |

|
2007-07-27 11:14:29 |
|
Hello-
I am programming Python (2.4.1) scripts to run on our Gentoo boxes and am having a bit of trouble I was hoping you could help me with. My file, hello.py looks like this:
#!/usr/bin/python print 'hello, python';
I add execute permission to the file and try to run it as follows:
myprompt $ ./hello.py
and get
-bash: ./hello.py: /usr/bin/env: bad interpreter: Permission denied
running /usr/bin/python brings up the python shell, so that's in place.
What am I missing to run these files (they run fine with I type in 'python' before the filename). BTW, I have the same issue running Perl scripts which is why I'm asking the question here.
Thanks for your help,
--greg
|
| Re: Running Scripts |
  Germany |
2007-07-27 12:04:36 |
Greg Lindstrom writes:
> I am programming Python (2.4.1) scripts to run on our
Gentoo boxes and
> am having a bit of trouble I was hoping you could help
me with. My
> file, hello.py looks like this:
>
> #!/usr/bin/python
> print 'hello, python'
>
> I add execute permission to the file and try to run it
as follows:
>
> myprompt $ ./hello.py
>
> and get
>
> -bash: ./hello.py: /usr/bin/env: bad interpreter:
Permission denied
is is possible that you saved the text file in DOS format,
with CR-LF
endings instead of LF only?
If "od -t x2 hello.py" shows 0a0d sequences, this
is the case. You could
use dos2unix to convert.
Just guessing, but I sometimes got similar errors in such
cases.
Alex
--
gentoo-user gentoo.org mailing list
|
|
| Re: Running Scripts |
  United States |
2007-07-27 12:11:26 |
ON FRIDAY 27 JULY 2007, "GREG LINDSTROM"
<GSLINDSTROM GMAIL.COM> WROTE
ABOUT '[GENTOO-USER] RUNNING SCRIPTS':
> -BASH: ./HELLO.PY: /USR/BIN/ENV: BAD INTERPRETER:
PERMISSION DENIED
> RUNNING /USR/BIN/PYTHON BRINGS UP THE PYTHON SHELL, SO
THAT'S IN PLACE.
WHICH ENV
LS -L /USR/BIN/ENV
LS -L /USR/BIN/PYTHON
--
BOYD STEPHEN SMITH JR. ,= ,-_-. =.
BSS03 VOLUMEHOST.NET ((_/)O O(_))
ICQ: 514984 YM/AIM: DATWINKDADDY `-'(. .)`-'
HTTP://IGUANASUICIDE.ORG/ _/
|
|
| Re: Running Scripts |

|
2007-07-27 12:27:30 |
On 27 July 2007, Greg Lindstrom wrote:
> Hello-
>
> I am programming Python (2.4.1) scripts to run on our
Gentoo boxes and am
> having a bit of trouble I was hoping you could help me
with. My file,
> hello.py looks like this:
>
> #!/usr/bin/python
> print 'hello, python'
>
> I add execute permission to the file and try to run it
as follows:
>
> myprompt $ ./hello.py
>
> and get
>
> -bash: ./hello.py: /usr/bin/env: bad interpreter:
Permission denied
>
> running /usr/bin/python brings up the python shell, so
that's in place.
So the symlink from /usr/bin/python to the real binary is
correct and the real
binary has the right permissions.
If your line starting with "#!/" weren't the first
line in your script, you
would get a different error message. Same if the
"#" weren't the first
character in that line.
This leads to the question whether you can start *any*
executable from your
home directory (assuming you stored your script somewhere
under your home
directory). If not so, do you mount your /home partition
with the "noexec"
option?
Uwe
--
Jethro Tull: Maybe, I am not done yet!
--
gentoo-user gentoo.org mailing list
|
|
| Re: Running Scripts |

|
2007-07-27 13:13:08 |
|
Wow! Thanks for the help. See my comments below pertaining to individual remarks. --greg
Alex asked:
is is possible that you saved the text file in DOS format, with CR-LF
endings instead of LF only?
If "od -t x2 hello.py" shows 0a0d sequences, this is the case. You could
use dos2unix to convert.
$ od -t x2 hello.py 0000000 2123 752f 7273 622f 6e69 652f 766e 7020 0000020 7479 6f68 0a6e 7270 6e69 2074 6827 6c65 0000040 6f6c 202c 6f77 6c72 2764 000a 0000053
Nope. That looks good.
Boyd Wrote:
which env
ls -l /usr/bin/env ls -l /usr/bin/python I39;m not sure what you are asking here.
$ ls -l /usr/bin/e nv lrwxrwxrwx 1 root root 8 May 18 2006 /usr/bin/env -> /bin/env
$ ls -l /usr/bin/python lrwxrwxrwx 1 root root 9 May 18 2006 /usr/bin/python -> python2.4
Uwe Thiem < uwix iway.na">
uwix iway.na> wrote:This leads to the question whether you can start *any* executable from your
home directory (assuming you stored your script somewhere under your home directory). If not so, do you mount your /home partition with the "noexec" option? I have the same problem with Perl scripts; I haven't tried any others. Is there a way to tell how the partition is mounted? I'm sorry to say that I am a lowly user on the system and don't really know much about how it is set up.
Thank-you so much for your attention. This is a small problem, as I can run the scripts with python (or perl) then the filename. I'd just like to understand what's happening.
--greg
|
| Re: Running Scripts |

|
2007-07-27 13:47:52 |
On 27 July 2007, Greg Lindstrom wrote:
> Uwe Thiem <uwix iway.na> wrote:
> > This leads to the question whether you can start
*any* executable from
> > your
> > home directory (assuming you stored your script
somewhere under your home
> > directory). If not so, do you mount your /home
partition with the
> > "noexec" option?
>
> I have the same problem with Perl scripts; I haven't
tried any others. Is
> there a way to tell how the partition is mounted? I'm
sorry to say that I
> am a lowly user on the system and don't really know
much about how it is
> set up.
Post the content of your /etc/fstab. You should be able to
do that as a
normal user.
Kinda funny: Writing this while listening to Queen's
"Another One Bites The
Dust".
Uwe
--
Jethro Tull: Maybe, I am not done yet!
--
gentoo-user gentoo.org mailing list
|
|
| Re: Running Scripts |

|
2007-07-27 14:04:11 |
|
On 7/27/07, Uwe Thiem < uwix iway.na">uwix iway.na> wrote:
Post the content of your /etc/fstab. You should be able to do that as a normal user. Nope. I am denied access to /etc/fstab. Could this be (part of) the problem?
--greg
|
| Re: Running Scripts |

|
2007-07-27 14:18:28 |
|
what does ls -l /etc/fstab show?
|
| Re: Running Scripts |
  Italy |
2007-07-27 14:23:45 |
Am Freitag 27 Juli 2007 21:04 schrieb Greg Lindstrom:
> On 7/27/07, Uwe Thiem <uwix iway.na> wrote:
> > Post the content of your /etc/fstab. You should
be able to do that as a
> > normal user.
>
> Nope. I am denied access to /etc/fstab. Could this be
(part of) the
> problem?
> --greg
Please post the output of
cat /etc/group | grep $username
|
|
| Re: Running Scripts |
  Argentina |
2007-07-27 15:38:02 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Greg Lindstrom wrote:
> Nope. I am denied access to /etc/fstab. Could this be
(part of) the
> problem?
Try sending us the output of the "mount" command.
- --
Arturo "Buanzo" Busleiman - Consultor
Independiente en Seguridad Informatica
SHOW DE FUTURABANDA - Sabado 18 de Agosto 2007 (Speed King,
Capital Federal)
Entradas anticipadas a traves de www.futurabanda.com.ar -
Punk Rock Melodico
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGqleqAlpOsGhXcE0RCiefAJ9eiZgbRs04kJT0nf8y5ygDstD6HwCf
YbLo
rrTgSnosMUavlvXP+ljyXZU=
=HgEt
-----END PGP SIGNATURE-----
--
gentoo-user gentoo.org mailing list
|
|
|
|
|
about | contact Other archives ( Real Estate discussion Medical topics )
|