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


Groups > comp.lang.python > #69597

Re: Two Questions about Python on Windows

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
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; 'subject:Windows': 0.02; 'subject:Python': 0.06; 'correct.': 0.07; 'subject:Questions': 0.07; "'python": 0.09; 'executable': 0.09; 'imported': 0.09; 'latter': 0.09; 'present,': 0.09; 'windows,': 0.09; 'runs': 0.10; 'python': 0.11; 'up-to-date': 0.14; 'windows': 0.15; '.py': 0.16; 'extension,': 0.16; 'happily': 0.16; 'modules.': 0.16; 'renaming': 0.16; 'second-guess': 0.16; 'subject:Two': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'normally': 0.19; '(the': 0.22; 'command': 0.22; 'email addr:gmail.com&gt;': 0.22; 'creating': 0.23; 'file.': 0.24; 'question': 0.24; 'script': 0.25; '&gt;': 0.26; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'specified': 0.30; 'message- id:@mail.gmail.com': 0.30; 'linux.': 0.31; 'yes.': 0.31; 'file': 0.32; 'run': 0.32; 'copying': 0.34; 'could': 0.34; 'received:google.com': 0.35; 'done': 0.36; 'window': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'associates': 0.60; 'simply': 0.61; 'school': 0.64; 'between': 0.67; 'believe': 0.68; 'line,': 0.68; 'freebsd': 0.84; 'installer': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=/miawKPvxxSbEuRwTLyVreMDDhRWXurRGku3GC3RxgM=; b=NS8fQsN585+7wGy1wH2Ox32uyKxeTNyhlayJ5Ur2qdpRROqjan82HEYnupVUZ5Vkw1 ywqFQwseAEfeS72ica8gT5xBMZxxrbNfzy5C6G/DLtu8PkoftrXkksaCnRS3sRBwh95N clIE5hvuq5GcSEgj9eapu2jaPYtMYuPYU8Ok8F9mdQaoSJwdHKZ0+9WY3YfxaIu3PpF5 uqjq6aiZH09omk/VpSKKFkT9eFI+Q1f6G9iaLLSiwSKjWlQ41SDitvE6nsIkVl/8Em5N rJWSlfvVu/4yO5+NNOgRS2eypOmzbgEuFXeDp12yoVRTMa/DbkPsPwULmKDlnGQl4PXn YwkQ==
X-Received by 10.66.141.144 with SMTP id ro16mr8926454pab.131.1396547684875; Thu, 03 Apr 2014 10:54:44 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <lhk4el$91k$1@news.albasani.net>
References <lhk4el$91k$1@news.albasani.net>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Thu, 3 Apr 2014 11:54:04 -0600
Subject Re: Two Questions about Python on Windows
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=001a1133316cab44e004f6271880
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 <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.8846.1396547693.18130.python-list@python.org> (permalink)
Lines 82
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1396547693 news.xs4all.nl 2872 [2001:888:2000:d::a6]:34557
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:69597

Show key headers only | View raw


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

On Apr 3, 2014 11:12 AM, "Walter Hurry" <walterhurry@gmail.com> wrote:
>
> Normally my Python development is done on FreeBSD and Linux. I know that
on *ix I simply have to make foo.py executable (the shebang line is
present, of course) to make it runnable.
>
> For my son's school assignment, I have to help him with Python for
Windows.
>
> As I understand it, on Windows a .py file is not executable, so I need to
run 'python foo py', or use a .pyw file.
>
> Question 1: Do I make a .pyw file simply by copying or renaming foo.py to
foo.pyw?

Yes. The only distinction between .py and .pyw is that the Python installer
associates the former with Python.exe and the latter with Pythonw.exe.
Pythonw runs the script without creating a console window for stdin/stdout.

> Secondly, on *ix, if there's an up-to-date .pyc in the right place and I
run foo.py, Python will automagically use foo.pyc.

I don't believe this is exactly correct. Python will only use a .pyc
automatically for imported modules. For a file specified on the command
line, Python won't try to second-guess the user as to which file they
want.  The file could have a .php extension, and Python will happily run it
if the contents are valid Python code.

> Question 2: Does it work the same way on Windows, and does this apply
both to foo.py and foo.pyw?

Yes.

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


Thread

Two Questions about Python on Windows Walter Hurry <walterhurry@gmail.com> - 2014-04-03 17:06 +0000
  Re: Two Questions about Python on Windows maxerickson@gmail.com - 2014-04-03 10:31 -0700
    Re: Two Questions about Python on Windows Tim Roberts <timr@probo.com> - 2014-04-05 14:57 -0700
  Re: Two Questions about Python on Windows Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-03 11:54 -0600
  Re: Two Questions about Python on Windows Terry Reedy <tjreedy@udel.edu> - 2014-04-03 14:34 -0400
  Re: Two Questions about Python on Windows Ethan Furman <ethan@stoneleaf.us> - 2014-04-03 11:00 -0700
  Re: Two Questions about Python on Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-03 21:15 +0100
  Re: Two Questions about Python on Windows Ian Kelly <ian.g.kelly@gmail.com> - 2014-04-03 16:41 -0600
  Re: Two Questions about Python on Windows Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-04-03 23:57 +0100

csiph-web