Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


"#! /usr/bin/env python" does not work..... help

moonshineratmoonshinerat Member Posts: 4
Hi folks.

I've left this post on devshed as well but I can't get an answer and I'm real stuck.

I am trying to learn Python and I've done quite a bit in the last three weeks in the IDLE environment. However I am now trying to get my programs to execute from the command line in Fedora Linux using [italic]#! /usr/bin/env python[/italic] but I just can't get it to work.

I have [italic]env[/italic] and [italic]python[/italic] in the /usr/bin directory. I have changed the permissions using [italic]chmod +x[/italic] for my file and whenever I try to execute without the [italic]python[/italic] command Bash just reports command not found:

[b][[email protected] moonshinerat]#
bash: command not found
[[email protected] moonshinerat]# mycode
bash: mycode: command not found
[[email protected] moonshinerat]#[/b]

I'm at my wits end with this and I'm going to defect to Ruby if I can't get this simple thing to work. Thanks for any solutions guys,



  • JonathanJonathan Member Posts: 2,914

    1) Does just #!/usr/bin/python work?

    2) Does ./ work? If so, then to get it to work the way you want, you must put the current working directory in your path, or the directory where the script is.

    3) Make sure is chmod executable.

    4) Your problem is language independent. But if you're going to defect, at least defect to Perl! We have some awesome conferences, with lots of beer drinking on the evenings. :-)

    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");
  • utpalenduutpalendu Member Posts: 9
    step 1:
    execute pwd command
    step 2:
    PATH=$PATH:output of pwd command
    i.e add the current path to PATH environment variable then ony you can do it else ./filename.

Sign In or Register to comment.