python script as executable

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sandipm

    python script as executable

    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
  • Eric Wertman

    #2
    Re: python script as executable

    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 <sandip.more@gm ail.comwrote:
    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
    --

    >

    Comment

    • sandipm

      #3
      Re: python script as executable

      thanks it worked

      On Apr 29, 10:49 am, "Eric Wertman" <ewert...@gmail .comwrote:
      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 <sandip.m...@gm ail.comwrote:
      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?
      >

      Comment

      • Arnaud Delobelle

        #4
        Re: python script as executable

        sandipm <sandip.more@gm ail.comwrites:
        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

        Comment

        Working...