473,406 Members | 2,849 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

stop script without exiting interpreter

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 1499
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
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,...
2
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...
4
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...
6
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...
5
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
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...
2
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...
6
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...
1
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...
1
by: athul | last post by:
Stop Script error is shown in IE8. Can it be fixed by using javascript
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.