python script as executable

S

sandipm

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
 
E

Eric Wertman

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.
 
S

sandipm

thanks it worked

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.
 
A

Arnaud Delobelle

sandipm said:
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)?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top