-   Programming (
-   -   error when tying to run python script(bash error?) (

shanenin 01-10-2006 09:24 AM

error when tying to run python script(bash error?)
I am going mad trying to figure this out. I have a python script that runs fine if I start it like this

python /home/shane/bin/gettorrent
but if I run it directly like this

I get the following error

shane@mainbox ~ $ /home/shane/bin/gettorrent
: No such file or directory

the file is exectuable

shane@mainbox ~ $ ls -l /home/shane/bin/gettorrent
-rwxr-xr-x  1 shane users 6556 Jan  9 21:35 /home/shane/bin/gettorrent

and it starts with this

shane@mainbox ~ $ cat /home/shane/bin/gettorrent
#!/usr/bin/env python
# gettorrent-5b
import urllib, urllib2, cPickle, os, sys

I am sure I am doing something really dumb, but can't seem to see it.

bigearsbilly 01-10-2006 09:44 AM

do cat -vets
I bet you've got a DOS ^M at the end of the line.
if so use dos2unix to get rid of it.

shanenin 01-10-2006 10:42 AM

I bet you are correct, I will boot it up soon and check. I accidently erased the program off my linux box, so I copyied it over from my windows box.

shanenin 01-10-2006 10:50 AM

Thanks. That was the problem. I have had this problem before in the past. On occasion I will code on my windows box, then copy over to my linux box later.

bigearsbilly 01-10-2006 10:58 AM

yeah, I've spent a couple of days on and off wondering
why something hasn't been working. Then spent a few hours today
wondering why a server wasn't accepting connections. even did a reboot.
datalog directory 100% used!!!
solved both problems. Doh.

I should read my own signature!

shanenin 01-10-2006 11:01 AM

closure feels good :-)

All times are GMT -5. The time now is 01:41 AM.