python script as executable

Discussion in 'Python' started by sandipm, Apr 29, 2008.

  1. sandipm

    sandipm Guest

    Hi,
    I have written a python script to run from cron.
    I have put #!/usr/bin/env python at top. file executes correctly when
    I run using python filename.py but
    it fails to execute when try to run it like script/command.
    it throws error:
    :No such file or directory

    I am editing file from eclipse for python from windows. and then
    uploading on linus machine to run it.


    any pointers?

    sandip
     
    sandipm, Apr 29, 2008
    #1
    1. Advertising

  2. sandipm

    Eric Wertman Guest

    Try to ftp it in ascii mode, or find a dos2unix utility .. the file
    has probably got \r\n (windows) line terminators in it.. causes
    problems. I guess it's also possible that /usr/bin/env doesn't
    exist... not likely though.


    On Tue, Apr 29, 2008 at 1:36 AM, sandipm <> wrote:
    > Hi,
    > I have written a python script to run from cron.
    > I have put #!/usr/bin/env python at top. file executes correctly when
    > I run using python filename.py but
    > it fails to execute when try to run it like script/command.
    > it throws error:
    > :No such file or directory
    >
    > I am editing file from eclipse for python from windows. and then
    > uploading on linus machine to run it.
    >
    >
    > any pointers?
    >
    > sandip
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
     
    Eric Wertman, Apr 29, 2008
    #2
    1. Advertising

  3. sandipm

    sandipm Guest

    thanks it worked

    On Apr 29, 10:49 am, "Eric Wertman" <> wrote:
    > Try to ftp it in ascii mode, or find a dos2unix utility .. the file
    > has probably got \r\n (windows) line terminators in it.. causes
    > problems. I guess it's also possible that /usr/bin/env doesn't
    > exist... not likely though.
    >
    > On Tue, Apr 29, 2008 at 1:36 AM, sandipm <> wrote:
    > > Hi,
    > > I have written a python script to run from cron.
    > > I have put #!/usr/bin/env python at top. file executes correctly when
    > > I run using python filename.py but
    > > it fails to execute when try to run it like script/command.
    > > it throws error:
    > > :No such file or directory

    >
    > > I am editing file from eclipse for python from windows. and then
    > > uploading on linus machine to run it.

    >
    > > any pointers?

    >
    > > sandip
    > > --
    > > http://mail.python.org/mailman/listinfo/python-list
     
    sandipm, Apr 29, 2008
    #3
  4. sandipm <> writes:

    > Hi,
    > I have written a python script to run from cron.
    > I have put #!/usr/bin/env python at top. file executes correctly when
    > I run using python filename.py but
    > it fails to execute when try to run it like script/command.
    > it throws error:
    > :No such file or directory
    >
    > I am editing file from eclipse for python from windows. and then
    > uploading on linus machine to run it.
    >
    >
    > any pointers?


    Have you made your file executable (man chmod)?

    --
    Arnaud
     
    Arnaud Delobelle, Apr 29, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lamar_air
    Replies:
    3
    Views:
    678
    Dennis Lee Bieber
    Jul 12, 2003
  2. Replies:
    15
    Views:
    510
    Dave Thompson
    Aug 21, 2006
  3. pratap
    Replies:
    20
    Views:
    790
    Flash Gordon
    Mar 7, 2007
  4. Jason Cavett
    Replies:
    8
    Views:
    657
    Sanjay
    May 16, 2007
  5. Replies:
    0
    Views:
    460
Loading...

Share This Page