shanenin Posted January 10, 2006 Report Share Posted January 10, 2006 I am going mad trying to figure this out. I have a python script that runs fine if I start it like thispython /home/shane/bin/gettorrentbut if I run it directly like this /home/shane/bin/gettorrentI get the following errorshane@mainbox ~ $ /home/shane/bin/gettorrent: No such file or directorythe file is exectuableshane@mainbox ~ $ ls -l /home/shane/bin/gettorrent-rwxr-xr-x 1 shane users 6556 Jan 9 21:35 /home/shane/bin/gettorrentand it starts with thisshane@mainbox ~ $ cat /home/shane/bin/gettorrent#!/usr/bin/env python## gettorrent-5b#import urllib, urllib2, cPickle, os, sysI am sure I am doing something really dumb, but can't seem to see it. Quote Link to post Share on other sites
jcl Posted January 10, 2006 Report Share Posted January 10, 2006 The colon in the error in odd. Have you tried sprinkling prints in the script to see if it's running? Quote Link to post Share on other sites
shanenin Posted January 10, 2006 Author Report Share Posted January 10, 2006 (edited) The problem was I origianlly wrote this using drpython on windows. So drpython added both a carriage return and a newline. So to run it on my linux system I needed to remove the "\r" carriage return.I was reading on the differnt line endings differnt OSs use. they say unix uses a \n. Is that a property of bash that requires this? Edited January 10, 2006 by shanenin Quote Link to post Share on other sites
iccaros Posted January 11, 2006 Report Share Posted January 11, 2006 (edited) its the diffrece between msdos text file type and unix type.. /r/n for dos /n for unix you can do this dos2unix filename filenamethis should fix it.. you may hve to install dos2unixgentoo has two program dos2unix or hd2u (hanny's dos 2 unix)the first will need to be unmasked but I know it works.. Edited January 11, 2006 by iccaros Quote Link to post Share on other sites
shanenin Posted January 11, 2006 Author Report Share Posted January 11, 2006 as soon as I opened it using drpython on my linux box, it reccomended I change my dos line ending to unix style. Drpython did it for me. Quote Link to post Share on other sites
jcl Posted January 11, 2006 Report Share Posted January 11, 2006 (edited) I was reading on the differnt line endings differnt OSs use. they say unix uses a \n. Is that a property of bash that requires this?POSIX requirement and Unix tradition. Text lines are terminated by ASCII LFs (0x0a). (Fun project: A sequence of characters that isn't terminated with a newline isn't a line of text according to POSIX. Count how many text files you have that technically aren't text files.). On the other hand CRLF pairs are not uncommon in display and network protocols. Edited January 11, 2006 by jcl Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.