View Single Post
Old 03-01-2012, 10:43 AM   #314
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Quote:
Originally Posted by KevinH View Post
I said "unpack it properly" and you won't have issues.
We're talking at cross purpose then; if your purpose is to help me get it running, you don't need to - I know how to fix newlines, so you don't have to tell me about unzip, dos2unix, etc.

My purpose was to point out a minor problem in your software which has to be fixed on your end. I know how to fix it my self - others may not. And while unzip is able to convert newlines with an option, this just is not done usually. No one even thinks of it because files are supposed to be correct in the archive in the first place.

It's unfortunate that Linux has problems with \r in the shebang line, as Python itself does not care either way about it. Part of the blame lies also with coreutils (/usr/bin/env) as it prints out the filename verbatim, causing the error message:

Code:
/usr/bin/env: python\r: No such file or directory.
To show up as:

Code:
: No such file or directory.
instead, since the \r throws the cursor back to the beginning of the line and the following text overwrites the beginning of the message.

Without /usr/bin/env you get an error message such as this:

Code:
bash: ./Mobi_Unpack.pyw: /usr/bin/python^M: bad interpreter: No such file or directory
So the \r has been replaced with ^M which gives the user a more useful error message.


As it is, Python source code just has to be using Unix newlines to be cross platform. Any one who works with or edits Python code should be aware of it (any proper coding editor would not turn \n into \r\n unasked anyway). Windows \r\n is Windows only, unfortunately.
frostschutz is offline   Reply With Quote