Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my program work with a .py extension but not with a .pyw extension?

I have a script that converts Google Earth .kml / .kmz files to shapefiles with a simple GUI interface written in Tkinter.

My problem is that it works fine with a .py extension, but when saved out with a .pyw extension it stalls while reading my .kml files.

There are no error messages and it doesn't crash. The GUI launches OK, etc, but it just stops and always at about the same place. I'm using Python 2.5, and had the same results with Python 2.7.

Any ideas what could cause this?

like image 572
Nick Avatar asked Apr 11 '12 21:04

Nick


1 Answers

.pyw files are run differently than .py files -- they are associated with a different interpreter, pythonw.exe instead of python.exe, which doesn't have a console associated with it.

According to some sources, including this old mailing list thread some operations don't work without a console.

Without seeing the exact script, we can't know exactly is causing the problem for pythonw.

like image 137
agf Avatar answered Oct 12 '22 06:10

agf