[wingide-users] .py vs .pyw extension

Steve Barnes gadgetsteve at hotmail.com
Sat Mar 15 05:04:43 EDT 2014


On 15/03/14 02:44, Chris O'Halloran wrote:
> Hello all,
>
> I'm running Wingware 5.0.3-1 Pro version on my Ubuntu 12.04 laptop
>
> While I develop at home I use the software on my Windows 8 machine at 
> work.  I use the .pyw extension because it avoids the console being 
> displayed while running my PyQt apps.
>
> I'm a novice programmer but a long time user of Linux.I use git and 
> github to share my software to and from work.  I mention all this in 
> case this is related to the following. I'm aware git does some clever 
> things with Windows and Linux line ends so that they don't show up as 
> differences
>
> In Wingware I find the syntax highlighting does not work as expected 
> for .pyw extensions and I'm not sure how to fix this.  There is some 
> mention in the wingware changelog in 2002 about it being now 
> recognised as a python file but nothing recent.
>
> Here is a screenshot showing a comparison of exactly the same file, ie 
> copied using SaveAs.  You'll see the .py file has the default syntax 
> highlighting whereas the .pyw file only has one or two things highlighted.
>
> http://photos.blahdeblah.co.nz/wingware/wingware_pyw_py_syntax_highlighting.png
>
> I've even added pyw to the list of python files and this doesn't seem 
> to work either.
>
> http://photos.blahdeblah.co.nz/wingware/wingware_pyw_py_syntax_highlighting1.png
>
>
> Cheers,
>
> Chris
>
>
>
>
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide
Chris,

On Linux and Wing on Linux the file extension is *not* how the file type 
is recognised but rather the MIME Type as specified by what is called 
the "shebang line" - this means that while for windows any file that has 
.py or .pyw as its extension is a python file but on Linux any file that 
starts with #!/usr/bin/env python as the first line is a python file.  I 
suspect that your .pyw files are lacking this line!

N.B. The second line should always be the encoding such as #encoding 
ascii or #encoding utf-8 to inform the editor which characters are valid 
in the file.

I know that both lines are comments but they are comments that are used 
for something in this case if that makes sense.

Gadget/Steve

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/wingide-users/attachments/20140315/698d54a0/attachment.html>


More information about the wingide-users mailing list