Stopping running code - python

I'd like to stop code while running in Spyder, but ctrlc/ ctrlz nor cmdc/ cmdz does not work for me, even the blue stop button (normally used for debug).
I work under Yosemite 10.10.3 and am using Spyder 2.3.4 and Python 2.7
Has someone encountered the same issue?

The consoles both python and ipython, when executing code have a stop button in the top right corner of the panes.
The debug button has no business with that as you rightly said it is for debugging, so unless you are debugging you should not expect it to stop a non debugging session.

Related

How to persist Python turtle graphics screen

I am learning Python (v 3.7) on a Mac using PyCharm. As I practice using the turtle library, the program runs without error, outputs the correct graphics, but then the graphics screen disappears immediately after the code completes runnning. Adding time.sleep(5) at the end of my program persists it and also shows that the focus changed from PyCharm to a Python program menu (which I can't find or turn on in the hope of keeping running).
When I use Thonny, the output persists, so I can check my work. How can I make it persist in PyCharm?
A well-structured Python turtle program will end with a call to mainloop() or one of its variants (exitonclick(), done()) This turns control over to the underlying tkinter event handler which will keep your window open, awaiting user events. Without this, the program simply ends and the window closes.
You don't need time.sleep() nor input("Press Enter to continue..."). Some Python programming environments clash with mainloop() but even those tend to disable it behind the scenes so the same code works everywhere.
First, do not use PyCharm to test. If you like it, more power to you, but personally, I have had many issues with output and PyCharm. Learn the command line, since you are using Mac. CodeAcacdemy and LinuxJournery have really good resources on that subject. Second, if you are still having issues, please reinstall trutle, Python 3.7 (there were some issues wiht it displaying on Mac), and macOS itself. Have a great day!
https://linuxjourney.com/
https://www.codecademy.com/learn/learn-the-command-line
Problems getting pygame to show anything but a blank screen on Macos Mojave

How can I know if a program in python is running in spyder?

I would like to know a silly question about using python. Currently, I am using spyder to write python. Take matlab as an example, when I run a program in matlab, I can see the word busy and I know matlab is running. Are there any similar signals which can help me to figure out if a program is running or not when I use spyder environment?
There is a red stop button on the top right of the IPython console. It is grayed out when there is nothing running, and becomes red when the console is 'busy'.

Pycharms debugger interactive console very slow

I just started trying out PyCharm, and while it is very nice, I found the interactive console in debugger (that can be activated with "Show Python Prompt" on a breakpoint) is unusably slow. If I keep pressing enter, for example, after 2-3 tries, I have to wait several seconds for the next prompt to show up.
Is this a common experience? I'm running Pycharm with a pretty fast machine (with i7-3770 CPU) so I was wondering if something is wrong.
I too have experienced the same problem quite a few times but With every new version released new problem too pop out . Its not the first time PyCharm is giving some one a hard time. In previous version the IDE would just stop working or not debug at all .
The best way to solve this is by writing to Jet Brains so they can find and solve the issue and release a new update.

Python Spyder: breakpoints working only once in a blue moon

I use Spyder 2.3.5.2 on an Anaconda Python installation running on Windows 7 64 bit.
The debug functionalities are very temperamental and unreliable. My breakpoints are often completely ignored. Sometimes applying the IT approach (closing and restarting the program) solves the issue, but more often than not it doesn't.
Some forums recommend running the program in the current ipython console, but that doesn't help, either.
Is there anything I can do?
Thanks.
I could not get Sypder to stop at break points (inserted with f12). But then in reading the docs I realized I needed to switch to debug mode (Ctrl-f5 or Debug->Debug). This switches the IPython console prompt to:
ipdb>
Once in this mode, break statements work.

spyder keep window open after execution?

How do you prevent spyder IDE from automatically closing the window after executing a program?
Windows 7
Anaconda 2.7 package.
I don't have this issue with geany. I'm sure I need some sort of command in the compiling options but I've googled for a couple hours and haven't found anything about this extremely EXTREMELY simple problem.
My test code:
for i in range(10):
print(1)
I want to see all of the 1s sitting there in front of me until I click close.

Categories