473,804 Members | 3,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Blocking the execution of a script


Hi,
I would like Python to interrupt the execution of a script in case an if
condition turns out to be TRUE. What is the proper way to do that?

Thanks,
a.

--
=============== =============== =============== ===========
Angelo Secchi PGP Key ID:EA280337
=============== =============== =============== ===========
Current Position:
Graduate Fellow Scuola Superiore S.Anna
Piazza Martiri della Liberta' 33, Pisa, 56127 Italy
ph.: +39 050 883365
email: se****@sssup.it www.sssup.it/~secchi/
=============== =============== =============== ===========

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

iD8DBQFBHJ2ZigT T+OooAzcRAlkrAJ 9GF9vXqUNBtN/mQFqOHtpxAL+6Bg CcDbqW
by67ofbCJ7yc1Sh Z6ayAb28=
=Xmnl
-----END PGP SIGNATURE-----

Jul 18 '05 #1
1 1409
In article <ma************ *************** ***********@pyt hon.org>, Angelo Secchi wrote:

Hi,
I would like Python to interrupt the execution of a script in case an if
condition turns out to be TRUE. What is the proper way to do that?

Thanks,
a.


import sys

if cond:
sys.exit(1)
Hth,

PterK

--
Peter van Kampen
pterk -- at -- datatailors.com
Jul 18 '05 #2

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

Similar topics

6
12413
by: Tanel | last post by:
Hello, I need to read a result of the first script (that takes some time to run) from the second script so that the first script doesn't block the second. Here is a short example. do_smth_else() should be called during test.php's sleep, instead the first fgets blocks the processing of the parent script and do_smth_else is called only once. How can I do a non-blocking fgets()? I use php 4.3.4 on windows xp $process = popen("c:\php\php...
4
7807
by: Richard | last post by:
hi, I am using SQL SERVER 2000. Problem that i am facing is when ever I check locks in Enterprise Manager I find following blocking - : 1) sp_cursoropen;1 2) sp_cursorclose;1 3) sp_cursorfetch;1
23
6533
by: David McCulloch | last post by:
QUESTION-1: How can I detect if Norton Internet Security is blocking pop-ups? QUESTION-2a: How could I know if a particular JavaScript function has been declared? QUESTION-2b: How could I know if Window.Open has been redefined? BACKGROUND:
38
3408
by: Emmett | last post by:
I have a simple jacascript that randomizes the background of the top frame of my webpage http://www.duke.edu/~efn. For some reason, my Internet Explorer started blocking the background and displaying this instead: http://www.duke.edu/~efn/pic.jpg. This problem didn't used to occur, and it doesn't happen on Firefox. Is there some way I can alter the script of the top frame http://www.duke.edu/~efn/top.html to prevent this from happening?...
2
13394
by: Tash Robinson | last post by:
I have been searching and can not seem to find a good example of a working UDP client that listens, but does not block while waiting for data arrival. I am trying to write a client application that needs to listen on several TCP ports and one UDP port. It will send a start signal over UDP and then a repeated status message of a fixed length will be returned from the server. I need to listen to these messages, but I can't stop the...
7
17421
by: Michi Henning | last post by:
Hi, I'm using a non-blocking connect to connect to a server. Works fine -- the server gets and accepts the connection. However, once the connection is established, I cannot retrieve either the local or the remote endpoint from the client-side socket. The *really* strange thing is that Socket.LocalEndPoint is null. According to the doc, that's impossible: reading the LocalEndPoint
7
12137
by: Dave Hardy | last post by:
I have thread t1 . It spawns thread t2. I want to wait in thread t1 until the execution of thread t2 in completed. Bu t I do not want it to be a blocking wait since I want thread t1 to be responsive to WM_PAINT messages. I know how to do it in VC++ , but I have no idea how it can be done in C#. Please help!!! Regards, Dave
5
2096
by: Simon Knox | last post by:
Hi I have a web app that has a legitimate use for pop up windows. My web app is an insurance quoting app. I use the window.open method to display another aspx page so that the user can check some information without losing where they are up to in the application process.
4
1572
by: Lunchtimemama | last post by:
I have a UI with a gallery of thumbnail image previews. The PictureBoxes are created and their Images are generated by a method which quickly retrieves the icon for the filetype. Worker threads then asynchronously retrieve and resize the full image previews and update the PictureBox's Images when the new images are ready. The way I have it set up now, the method which generates the filetype icons creates and starts the new worker Threads....
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10076
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...
1
7616
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
6851
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();...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3816
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.