Re: 2 Newbie questions.

From: Steven Bethard (steven.bethard_at_gmail.com)
Date: 10/07/04


To: python-list@python.org
Date: Thu, 7 Oct 2004 06:21:26 +0000 (UTC)

Len Sumnler <pcslen <at> comcast.net> writes:
> I have searched the net and performed chmod +x mypython.py and added as the
> first line of my program #!/usr/bin/env python. When I try to run the
> program as follows $ mypython.py I get the error message of, "bash:
> mypython.py: command not found". What am i doing wrong.

Not really a Python question, but maybe I can help anyway. A couple of things
to check:

1) Does "/usr/bin/env python" work at the shell prompt? If not you probably
don't have python on your path.

2) If "/usr/bin/env python" does work for you from the shell, did you create
mypython.py on a Windows machine? I've gotten these errors occasionally when
moving a script from a Windows box to a Unix box because the shell doesn't
like the \r's that Windows puts at the end of lines. You could try using
dos2unix or a similar script to remove these.

Steve



Relevant Pages

  • Re: setting file permissions on a web server
    ... > method you use to transfer files the file permissions may or may not ... > you transfer first and chmod on the server. ... Since I'm running Windows, I ... What I would do is write a script ) ...
    (comp.lang.python)
  • Re: rmdir and chmod help for Windows XP Home!
    ... chmod and rmdir are UNIX commands which have no effect in a Windows ... > in a test script and everything went OK... ...
    (comp.lang.php)
  • rmdir and chmod help for Windows XP Home!
    ... From what I read from the PHP manual, chmod on a Windows platform ... I create a directory on my Windows box, and set chmod 777 on it (that ... I can create/delete subdirectories either by hand or by script with no ... So, for PHP on windows, chmod 777 makes the file undeletable ...
    (comp.lang.php)
  • Re: 2 Newbie questions.
    ... > Not really a Python question, but maybe I can help anyway. ... > moving a script from a Windows box to a Unix box because the shell doesn't ... > dos2unix or a similar script to remove these. ... Dr. Sibylle Koczian ...
    (comp.lang.python)
  • Re: 2 Newbie questions.
    ... Sibylle Koczian wrote: ... >> Not really a Python question, but maybe I can help anyway. ... >> occasionally when moving a script from a Windows box to a Unix box ... You could try using dos2unix or a similar script to remove ...
    (comp.lang.python)