473,671 Members | 2,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sys.exit call from pythonw.exe gives error

I wrote a python GUI with tkInter and installed it on a windows machine
with the .pyw extension, so it will be executed from pythonw.exe instead
of python.exe, since I didn't want the console window to appear.
My application exits with a call to sys.exit. However, when this call is
executed under pythonw.exe I get an error popup window with the
following messeage:

---- start quote ----
Microsoft Visual C++ Runtime Library
Runtime Error!
Program: C:\Python24\pyt honw.exe

This application has requested the Runtime to terminate in an unusual way.
Please contact the application support team for more information
---- end quote ----

What am I doint wrong here?

Jo

--
Dr Joachim Schambach
The University of Texas at Austin
Department of Physics
1 University Station C1600
Austin, Texas 78712-0264, USA
Phone: (512) 471-1303; FAX: (814) 295-5111
e-mail: js******@physic s.utexas.edu
Oct 27 '05 #1
1 2964
I wrote the following small program:
#-----------------------------------------------------------------------
import sys, Tkinter
t = Tkinter.Tk()
b = Tkinter.Button( command=lambda: sys.exit(0), text="Click to exit")
b.pack()
t.mainloop()
#-----------------------------------------------------------------------
and ran it with pythonw.exe from python 2.3.4 on a machine running Windows NT
4.0. (I actually used Start > Run and entered "d:\python23\py thonw.exe x:\app.pyw"
rather than clicking on the app.pyw icon, but this shouldn't make a difference)

When the button is clicked, the application exits without giving any error like
the one you described.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFDYP5ZJd0 1MZaTXX0RAhycAJ wMz1iwumT9iKP/n51ExW38/qfDBACgnCHn
RomJvAYSNpo9SnY 2pzWOwy8=
=x7wc
-----END PGP SIGNATURE-----

Oct 27 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
6653
by: Eric Ching | last post by:
Can I run pythonw with a script that takes command line arguments then launches a GUI? I try pythonw myscript.pyw -option arg (etc.) and nothing happens. Nothing, as in I am immediately returned to the DOS prompt. I just started learning Python a couple of weeks ago, so please bear with me. I have a script that(for now) uses command line arguments then launches a window (Tk). Once I have entered the arguments and the window is...
3
2174
by: vm_usenet | last post by:
Hi everyone, I've seen this subject come up in another thread, but not getting enough attention - so I'll just ask it: When running python code via pythonw, what exactly happens to stderr? I tried running code that, among else, writes to stderr - and at some point I get an IOError claiming "Bad file descriptor". Why is this happending?
1
8515
by: Guinness Mann | last post by:
Pardon me if this is not the optimum newsgroup for this post, but it's the only .NET newsgroup I read and I'm certain someone here can help me. I have a C# program that checks for an error condition and if it finds it it notifies the user with a MessageBox and then on the next line of code (example in a minute) it calls Application.Exit(). To my astonishment, I stepped through the code with the debugger, and watched it call...
5
1829
by: pafgbs | last post by:
I wanted to use some of my MFC stuff in a new C# applikation, so I made an activeX/ocx of my a database viewer. Tested ocx i VB 6.0 and MFC app, worked fine. Tested ocx i a C# .NET app, and upon exit I get ".NET BroadcastEventWindow 1.0.5000.0.2" error. Some debugging indicates that the error occurs in AfxDaoTerm: pDaoState->m_pDAODBEngine->Release(); Anyone know the solution to this one ?
3
1545
by: Mike Johnson | last post by:
I have the following code in form1 and when the application starts this sub is called to check for a path if not found a message box is displayed and then gives the user an option to end the application but when this option is selected the application does not end but continues to the next line of code which tries to setup a filewatcher with the path which does not exist, which then gives an error. please help. Public Sub Check_For_Dir()...
2
5943
by: GGerard | last post by:
Hello Is there a way to exit all running procedures with one command? Sometimes a procedure(1) will call another procedure(2) which could call a third procedure(3) and what I would like to do is give a command in procedure(3) that would exit all three procedure without returning to procedure(1) and procedure(2)
4
1357
by: Mike C# | last post by:
Hi all, quick question. I have an application I'm running. There are some "fatal" error conditions that could occur during processing, and I want to exit immediately if one comes up. When I put an exit() function call in my code I get a message like this: Detected memory leaks! Dumping objects -> {177} normal block at 0x003864E8, 32 bytes long. Data: <c:\polling\inbou> 63 3A 5C 70 6F 6C 6C 69 6E 67 5C 69 6E 62 6F 75
4
2749
by: Siam | last post by:
Hi all, I have a big application that does all sorts of network and video processing related functions. On closing the program, Windows gives me the "This program has encountered an error and needs to close" (send error report..) error message. I've traced the error all the way to the exit(0) call at the end of the program. When would a call to exit(0) produce an error like this? I've tried to ensure I'm closing all network connections...
3
1617
by: Matthew Fitzgibbons | last post by:
I've got a pretty complex interactive command line program. Instead of writing my own REPL, I'm using the Python interpreter (an infinitely better solution). This program has two threads, a background thread and the REPL thread. When you call quit() or sys.exit() in the REPL thread, everything is perfectly happy. However, the background thread does some long-running jobs, and I want it to have the ability to exit the program when the job...
0
8472
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8909
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1801
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.