473,548 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stop script without exiting interpreter

2 New Member
This is a continuation to an old post (http://bytes.com/topic/python/answer...ng-interpreter) that I think a found a better answer.

The question was:
"I'm fairly new to Python and I've lately been running a script at
the interpreter while working on it. Sometimes I only want to
run the first quarter or half etc. What is the "good" way to do this?

Possible ugly hacks include:

- stick an undefined name at the desired stop point
- comment out the last half

I do not like these and assume that I have overlooked the obvious.

Thanks,
Alan Isaac"
Jun 17 '14 #1
1 1503
homerobse
2 New Member
Expand|Select|Wrap|Line Numbers
  1. from IPython import embed
  2.  
  3. def f():
  4.     b=2
  5.     embed() # this stops execution and goes to the interpreter
  6.  
  7. print 'oi'
  8. a=1
  9. f()
Jun 17 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
9442
by: Timo-Pekka Oikarinen | last post by:
Is there PHP chat script *without* MySQL? Demands: absolutely FREE (no adware, shareware etc.), No MySQL needed, one permanent public chat, can make your own channels (public/private) like IRC, several admins (one superadmin, me ;-D ), bad word filter, user nick ban/ip ban/kick (temporary/permanent), small file sharing and @time script (...
2
3032
by: Hal Vaughan | last post by:
I have a class that is sometimes called from the command line and sometimes from another class. When the user clicks "Quit" on the panel it opens, if it is running from the command line, it quits. The problem is that I need a way to terminate the class and the object without using quit, so it doesn't kill other classes. The QUIT button...
4
2198
by: redryderridesagain | last post by:
My macro is writing to a table(T) and reading a query (Q) based on that table (VBA/Visual Basic 6.3). I cannot write T and read Q in the same execution of the macro, however, if I skip the writing part I can read Q just fine. How does closing the macro reset the state of the system? The SQL for Q is-- SELECT Relatesto.contains,...
6
1956
by: keyser_Soze | last post by:
Nube warning! I have a PHP script that does some calculations of user input. Under certain circumstances, I would like to have a popup on the user's computer. Since PHP can not do this on the client, I thought I would have PHP load a 'popup' page which would contain the javascript to do the popup.
5
1841
by: dananrg | last post by:
In PythonWin, is there any way to bulk-delete all objects without using "del object" for each, and without having to exit out of PythonWin?
0
1760
by: Dirk Runge | last post by:
Hi! I have embedded Python in an C++ App. The Python-Interpreter is running in its own Thread (I'm using PThreads). I use PyRun_SimpleString to run Python-Code that the user entered in an editorwindow. I want the user to be able to stop the execution of Python-Code (e.g. using a Cancel-Button).
2
1151
by: Ruben | last post by:
Hi all, I wrote a php script which functions as a plugin for a Windows application. The Windows application simply calls the php script at certain triggers. This all works fine, except that every time the php script is called a commandbox is shown. The command is like this: php.exe -q script.php Is it possible to have the php script do...
6
15020
by: Alan Isaac | last post by:
I'm fairly new to Python and I've lately been running a script at the interpreter while working on it. Sometimes I only want to run the first quarter or half etc. What is the "good" way to do this? Possible ugly hacks include: - stick an undefined name at the desired stop point - comment out the last half I do not like these and...
1
1583
by: djpaul | last post by:
Hello, I am just a newbie to javascript, but the most stuff i do is in php or .net. But, now i have 2 buttons on my script that are calling a javascript function as shown below (OnClick""). Now after a person pushes 1 of the 2 buttons, i want to send some information to a php-file to update my database. The only thing that the customer will...
1
2038
by: athul | last post by:
Stop Script error is shown in IE8. Can it be fixed by using javascript
0
7518
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...
0
7444
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...
0
7711
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. ...
1
7467
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...
0
5085
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...
0
3497
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...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
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
1
1054
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.