pythonw

can't execute pyw on windows

只愿长相守 提交于 2020-01-15 09:36:09
问题 I want to hide the console window of a python program, so I change the file extensions to "pyw", but when I open it, the python IDLE show up even though I choose open it with "pythonw.exe" If I use "pythonw test.py" in cmd, it works. So I want to know what's wrong with this and how to solve this, thank you. 回答1: Change the program that opens python files. Assuming you're using Windows, right click any python file (in your case any .pyw file, not .py), properties, change Opens with to pythonw

can't execute pyw on windows

≡放荡痞女 提交于 2020-01-15 09:35:10
问题 I want to hide the console window of a python program, so I change the file extensions to "pyw", but when I open it, the python IDLE show up even though I choose open it with "pythonw.exe" If I use "pythonw test.py" in cmd, it works. So I want to know what's wrong with this and how to solve this, thank you. 回答1: Change the program that opens python files. Assuming you're using Windows, right click any python file (in your case any .pyw file, not .py), properties, change Opens with to pythonw

Python code problem, application has been destroyed Tcl error

别说谁变了你拦得住时间么 提交于 2020-01-06 19:27:39
问题 I am making a Tkinter GUI to do nothing except call images - and of course, I have struggled to find decent tkinter documentation all along. There is a line of my code which cannot seem to do as asked - I want to call up all the values in a dictionary and individually print and pull an image by the same name for each one before the next value is called up. I have tried dict.itervalues() and dict.values() and can't seem to figure anything out altogether... Anyway, here is the snippet: for key

Module cannot be found when using “pythonw” (instead of “python”) to run an application

爱⌒轻易说出口 提交于 2019-12-24 05:11:36
问题 I tried this minimal example: from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello World!' if __name__ == '__main__': app.run(debug = True) When I try python hello.py , everything goes well. However, when I try to run it from Textmate (Shift + Cmd + R) an error is thrown: Traceback (most recent call last): File "/Users/user/EventFeed/hello.py", line 1, in <module> from flask import Flask ImportError: No module named flask Textmate calls pythonw

Python freezes after computer sleep/hibernate

試著忘記壹切 提交于 2019-12-22 18:20:16
问题 I have a python script that is running in the background with pythonw. If I close my laptop, it goes into sleep mode. and when I open my laptop, my program has little functionality and freezes after a couple of seconds. Is there any way that my script can tell if my computer is going into sleep mode, so that it can lie dormant and restart when I re-open my laptop? 回答1: You can catch WM_POWERBROADCAST window message with PBT_APMQUERYSUSPEND event inside it. To catch this message inside Python

Code that works with python and not with pythonw

喜夏-厌秋 提交于 2019-12-13 21:50:51
问题 I am writing a script and I want it to run in the back ground and to manifest itself every 6 hours. I don't want to have an opened console all the time, I want tkinter to pop a window in which it prints the output of the script that i can then close and that will do the same in 6 hours. There is my code. from datetime import datetime import time from tkinter import Tk, Label dict_n = {} def func(): def check(): today = datetime.today() a = str(today.day) + "/" + str(today.month) li_b = [] li

Microsoft Visual C++ Runtime Error in Python

匆匆过客 提交于 2019-12-08 18:56:46
问题 I have a python program that runs in a server continuously and it puts some data into MYSQL dataBase and load some. It is also using TCP/IP connection. the problem is that after about 24 hrs it gives a runtime error: Microsoft Visual C++ Runtime Library! Runtime Error! Program: C:\python27\pythonw.exe This application has requested the Runtime to terminate it in an unusual way. And I hit OK python shell closes. And when I close all python files and check Windows Task Manager I see still there

How to print to stdout from Python script with .pyw extension?

痞子三分冷 提交于 2019-12-06 21:52:26
问题 I have a python program with a wxpython GUI and some command line parameters. I generate a single windows executable with py2exe. I don't want to have a command line window in the background, so py2exe is making this a pythonw executable without this window. This is equivalent to use the *.pyw extension. The problem is, if you want to see the available command line arguments, you naturally do "main.exe -h" on a shell. Even though argparse is providing this information, it doesn't reach stdout

Python freezes after computer sleep/hibernate

☆樱花仙子☆ 提交于 2019-12-06 06:03:32
I have a python script that is running in the background with pythonw. If I close my laptop, it goes into sleep mode. and when I open my laptop, my program has little functionality and freezes after a couple of seconds. Is there any way that my script can tell if my computer is going into sleep mode, so that it can lie dormant and restart when I re-open my laptop? You can catch WM_POWERBROADCAST window message with PBT_APMQUERYSUSPEND event inside it. To catch this message inside Python program, you can create new invisible window and make separate thread repeatedly calling GetMessage() . In

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

醉酒当歌 提交于 2019-12-04 03:30:00
问题 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? 回答1: .pyw