Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39892

Re: Shebang line on Windows?

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@gonnerman.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; '(at': 0.03; 'linux,': 0.05; 'removes': 0.05; 'executable': 0.07; 'overflow': 0.07; 'subject:Windows': 0.09; 'python': 0.09; '22,': 0.09; 'follows.': 0.09; 'friday,': 0.09; 'received:184.172': 0.09; 'scripts,': 0.09; 'itself.': 0.11; 'thread': 0.11; 'stack': 0.15; '(and,': 0.16; 'carriage': 0.16; 'chmod': 0.16; 'complained': 0.16; 'reason.': 0.16; 'received:69.93': 0.16; 'received:gateway01.websitewelcome.com': 0.16; 'resolved:': 0.16; 'sed': 0.16; 'skip:[ 60': 0.16; 'windows?': 0.16; 'wrote:': 0.17; 'message-----': 0.17; '>>>': 0.18; 'platforms': 0.18; 'windows': 0.19; 'feb': 0.19; 'email addr:gmail.com&gt;': 0.20; 'to:name :python-list@python.org': 0.20; 'assuming': 0.22; 'features,': 0.22; 'from:addr:chris': 0.22; 'latter': 0.22; '&gt;': 0.23; 'this:': 0.23; 'installed': 0.23; "i've": 0.23; 'tried': 0.25; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'am,': 0.27; 'question': 0.27; 'run': 0.28; 'editors': 0.29; 'url:mailman': 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'url:python': 0.32; 'file': 0.32; 'running': 0.32; 'skip:- 10': 0.32; 'url:listinfo': 0.32; 'to:addr:python- list': 0.33; 'or,': 0.34; 'pm,': 0.35; 'subject:?': 0.35; 'similar': 0.35; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'does': 0.37; 'sent:': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'end': 0.40; 'url:mail': 0.40; 'son': 0.60; 'save': 0.61; 'here:': 0.62; 'email name:python-list': 0.62; 'provide': 0.62; 'benefit': 0.70; 'received:199': 0.71; '2013': 0.84; 'ok?': 0.84; 'ware': 0.91; 'forever.': 0.93
Date Mon, 25 Feb 2013 07:28:53 -0600
From Chris Gonnerman <chris@gonnerman.org>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To "python-list@python.org" <python-list@python.org>
Subject Re: Shebang line on Windows?
References <kg8cm0$flo$1@news.albasani.net> <CAKJDb-NW2ut0=6n_TD3VC=5pR5rc+kOfHANtjVxKB6EtFwtbNw@mail.gmail.com> <mailman.2294.1361558483.2939.python-list@python.org> <b94bb7c4-14c2-4783-b13d-8a77e8dd6f32@r8g2000vbj.googlegroups.com> <DCD75728F460F14586086EA606E8308282821A1D@ACEVXCHMBX1001.ADVENTISTCORP.NET>
In-Reply-To <DCD75728F460F14586086EA606E8308282821A1D@ACEVXCHMBX1001.ADVENTISTCORP.NET>
Content-Type multipart/alternative; boundary="------------090204040908080508030800"
X-AntiAbuse This header was added to track abuse, please include it with any abuse report
X-AntiAbuse Primary Hostname - gator191.hostgator.com
X-AntiAbuse Original Domain - python.org
X-AntiAbuse Originator/Caller UID/GID - [47 12] / [47 12]
X-AntiAbuse Sender Address Domain - gonnerman.org
X-BWhitelist no
X-Source
X-Source-Args
X-Source-Dir
X-Source-Sender ([10.0.1.176]) [199.127.49.110]:52849
X-Source-Auth chris@newcenturycomputers.net
X-Email-Count 2
X-Source-Cap bmV3Y2VudDtuZXdjZW50O2dhdG9yMTkxLmhvc3RnYXRvci5jb20=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2505.1361799399.2939.python-list@python.org> (permalink)
Lines 154
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361799399 news.xs4all.nl 6980 [2001:888:2000:d::a6]:49309
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39892

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On 02/25/2013 06:35 AM, Sells, Fred wrote:
> 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.
Or edit it in Vim and do

:se ff=unix

and then save it.

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.

Or, borrowed from a Stack Overflow thread here: 
http://stackoverflow.com/questions/800030/remove-carriage-return-in-unix

|sed 's/\r\n$/\n/' mymodule.py > mymodule-unix.py|


>
> -----Original Message-----
> From: Python-list [mailto:python-list-bounces+frsells=adventistcare.org@python.org] On Behalf Of James Harris
> Sent: Friday, February 22, 2013 5:53 PM
> To: python-list@python.org
> Subject: [Python] Re: Shebang line on Windows?
>
> On Feb 22, 6:40 pm, Zachary Ware <zachary.ware+pyl...@gmail.com>
> wrote:
>
>> On Fri, Feb 22, 2013 at 12:16 PM, Walter Hurry <walterhu...@lavabit.com> wrote:
>>> I use FreeBSD or Linux, but my son is learning Python and is using
>>> Windows.
>>> 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.
>> Adding the shebang line on Windows would be excellent practice.
> 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
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Shebang line on Windows? Walter Hurry <walterhurry@lavabit.com> - 2013-02-22 18:16 +0000
  Re: Shebang line on Windows? Dave Angel <davea@davea.name> - 2013-02-22 13:40 -0500
  Re: Shebang line on Windows? Zachary Ware <zachary.ware+pylist@gmail.com> - 2013-02-22 12:40 -0600
    Re: Shebang line on Windows? James Harris <james.harris.1@gmail.com> - 2013-02-22 14:53 -0800
      Re: Shebang line on Windows? MRAB <python@mrabarnett.plus.com> - 2013-02-22 23:21 +0000
      RE: Shebang line on Windows? "Sells, Fred" <fred.sells@adventistcare.org> - 2013-02-25 12:35 +0000
      Re: Shebang line on Windows? Dave Angel <davea@davea.name> - 2013-02-25 08:14 -0500
      Re: Shebang line on Windows? Chris Gonnerman <chris@gonnerman.org> - 2013-02-25 07:28 -0600
      Re: Shebang line on Windows? Chris Angelico <rosuav@gmail.com> - 2013-02-26 00:54 +1100
      Re: Shebang line on Windows? Michael Torrie <torriem@gmail.com> - 2013-02-25 10:18 -0700
        Re: Shebang line on Windows? Anssi Saari <as@sci.fi> - 2013-02-26 16:30 +0200
      Re: Shebang line on Windows? "D'Arcy J.M. Cain" <darcy@druid.net> - 2013-02-25 12:29 -0500
        Re: Shebang line on Windows? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-02-26 00:52 +0000
          Re: Shebang line on Windows? Michael Torrie <torriem@gmail.com> - 2013-02-25 19:08 -0700
          Re: Shebang line on Windows? Dave Angel <davea@davea.name> - 2013-02-25 21:23 -0500
          Re: Shebang line on Windows? MRAB <python@mrabarnett.plus.com> - 2013-02-26 03:08 +0000
          Re: Shebang line on Windows? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-02-25 22:44 -0500
      Re: Shebang line on Windows? David Robinow <drobinow@gmail.com> - 2013-02-25 13:19 -0500
      Re: Shebang line on Windows? Michael Torrie <torriem@gmail.com> - 2013-02-25 11:29 -0700
      Re: Shebang line on Windows? Michael Torrie <torriem@gmail.com> - 2013-02-25 11:33 -0700

csiph-web