<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 02/25/2013 06:35 AM, Sells, Fred
      wrote:<br>
    </div>
    <blockquote
cite="mid:DCD75728F460F14586086EA606E8308282821A1D@ACEVXCHMBX1001.ADVENTISTCORP.NET"
      type="cite">
      <pre wrap="">When moving from windows to unix you need to run "dos2unix"   on any programs that use shebang (at least with python 2.6)   that is installed on some platforms but must be installed on others like CentOs but it is in their repository.</pre>
    </blockquote>
    Or edit it in Vim and do<br>
    <br>
    :se ff=unix<br>
    <br>
    and then save it.<br>
    <br>
    dos2unix is handy if you don't plan to edit the file for any other
    reason.  I'm assuming other editors provide similar features, but
    I've been a vi/vim user FOREVER.<br>
    <br>
    Or, borrowed from a Stack Overflow thread here:
    <a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/800030/remove-carriage-return-in-unix">http://stackoverflow.com/questions/800030/remove-carriage-return-in-unix</a><br>
    <br>
    <pre><code>sed 's/\r\n$/\n/' mymodule.py > mymodule-unix.py</code></pre>
    <br>
    <blockquote
cite="mid:DCD75728F460F14586086EA606E8308282821A1D@ACEVXCHMBX1001.ADVENTISTCORP.NET"
      type="cite">
      <pre wrap="">

-----Original Message-----
From: Python-list [<a class="moz-txt-link-freetext" href="mailto:python-list-bounces+frsells=adventistcare.org@python.org">mailto:python-list-bounces+frsells=adventistcare.org@python.org</a>] On Behalf Of James Harris
Sent: Friday, February 22, 2013 5:53 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:python-list@python.org">python-list@python.org</a>
Subject: [Python] Re: Shebang line on Windows?

On Feb 22, 6:40 pm, Zachary Ware <a class="moz-txt-link-rfc2396E" href="mailto:zachary.ware+pyl...@gmail.com"><zachary.ware+pyl...@gmail.com></a>
wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">On Fri, Feb 22, 2013 at 12:16 PM, Walter Hurry <a class="moz-txt-link-rfc2396E" href="mailto:walterhu...@lavabit.com"><walterhu...@lavabit.com></a> wrote:
</pre>
      </blockquote>
      <pre wrap="">
</pre>
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">I use FreeBSD or Linux, but my son is learning Python and is using 
Windows.
</pre>
        </blockquote>
        <pre wrap="">
</pre>
        <blockquote type="cite">
          <pre wrap="">My question is this: Would it be good practice for him to put 
#!/usr/bin/ env python at the top of his scripts, so that if made 
executable on *nix they will be OK? As I understand it this will 
have no effect on Windows itself.
</pre>
        </blockquote>
        <pre wrap="">
Adding the shebang line on Windows would be excellent practice.
</pre>
      </blockquote>
      <pre wrap="">
A word of warning unless this has since been resolved: Whenever I have tried adding the shebang line on Windows and running it on Unix the latter has complained about the carriage return at the end of the line. This means that Unix does not work when invoked as follows.
(And, yes, the file has had chmod +x applied.)

  ./program.py

It is, of course, OK when run as

  python program.py

but that removes some of the benefit of the shebang line.

James
--
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-list">http://mail.python.org/mailman/listinfo/python-list</a>

</pre>
    </blockquote>
    <br>
  </body>
</html>