[Patches] [ python-Patches-446899 ] Permit import of .pyw under Windows

noreply@sourceforge.net noreply@sourceforge.net
Thu, 02 Aug 2001 05:42:10 -0700


Patches item #446899, was opened at 2001-08-01 12:02
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=446899&group_id=5470

Category: core (C code)
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: David Bolen (db3l)
Assigned to: Nobody/Anonymous (nobody)
Summary: Permit import of .pyw under Windows

Initial Comment:
Under windows, the extension .pyw is provided (in the 
default installation registry settings) to map scripts 
to pythonw.exe (no console) rather than python.exe.

While scripts thus named are generally top level 
scripts, in some cases even top level scripts are 
imported by other code (particularly with test 
harnesses).  However, Python itself does not recognize 
the pyw extension for import purposes.  While an 
explicit compilation of the pyw file can work around 
this, it is error prone and manual - and subject to 
failure if multiple Python releases are in use.

This patch adds .pyw as a possible source extension, 
on Windows only.  (With slight modification, it could 
permit the extension on any platform if desired).

The .pyw extension is secondary in the table to .py, 
so should both extensions exist (which is not a 
logical thing to do, but someone could do it), the 
import will find the .py prior to the .pyw.

The attached patch is against the CVS tree main branch 
as of 8/1.

-- David

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-02 05:42

Message:
Logged In: YES 
user_id=6380

I'm deleting the old patch for you.

I approve, except that it seems it would break if the
extension was ".Pyw" or ".pYw" etc. Sooner or later some
bozo will run into this, so better fix it now (or prove it
can't happen).


----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-08-01 23:31

Message:
Logged In: YES 
user_id=21627

I recommend to approve this patch.


----------------------------------------------------------------------

Comment By: David Bolen (db3l)
Date: 2001-08-01 12:25

Message:
Logged In: YES 
user_id=53196

I can't seem to delete the first diff file (even though 
it's my own patch submission), but please use the later 
version (SF file id 9138).  Thanks.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=446899&group_id=5470