I'm using PyCharm for debugging. One of the big headaches that I keep having is that even in debug mode, the IDE exits on an exception instead of breaking. There are already questions about this issue but they're all years or even a decade old, and PyCharm's UI has been heavily redesigned in the past years. Here's the Breakpoints window.
Link to the image (not enough reputation :():
https://imgur.com/8aZgFdT)
If I check the 'On raise' box, it breaks on handled exceptions which is unnecessary and unwieldy.
Here's the debug console. I want it to break on the failed assert instead of just exiting. https://imgur.com/X2BxW4S
Your settings seem OK. When I tried to reproduce the case the PyCharm IDE just stopped right at the AssertationError. Note the debug window in the bottom of the GUI where you can inspect the stack trace and variables. The last line Process finished with exit code 1 of your screenshot was not printed at that point.
Possible cases for exiting:
running the code (Shift+F10) instead of debugging (Shift+F9)
using a library that actually handles the exception (e.g. Jupyter notebook or unittest module)
and a less probale scenario that should have other symptoms: the python version 3.7 may be too new to the specific PyCharm, at least there was an incompatibility when using numpy https://intellij-support.jetbrains.com/hc/en-us/community/posts/360001194720-Numpy-import-error-in-PyCharm-Importing-the-multiarray-numpy-extension-module-failed-
This question is a possible duplicate for Break on unhandled exception in pycharm
Related
My current (PyCharm based) debugging workflow is to run a program in debug mode. When I run into an error, I fix it, and restart the program from the beginning.
Is it possible to save re-running the healthy part of the program by moving the program back by one step, fix the issue, and continue the program?
Is there a general way to do this, and one specific for PyCharm?
[edit:]
this is related but not similar to Is there "Edit and Continue" in PyCharm? Reload code into running program like in Eclipse / PyDev? , as there the author anticipates halts the program before an error occurs. here, i consider an error state
I am running my Python script using Pycharm on Mac.
The script is reading, processing and plotting some data.
When I place a debug point(often shortly after I plotted some charts), I encountered "python quit unexpectedly". My debugger logged:
"called Tcl_FindHashEntry on deleted table"
Would you please help? I want the program to stop at the debug point, instead of quitting.
Your error looks like its coming from the backend of MatPlotLib. Here is an open bug which references the same error. The bug may or may not be what you are experiencing, but has to do with window sizing and multiple screens.
As troubleshooting:
If multiple monitors or a dock are in use, try removing them from the equation.
Use Windows to examine breakpoint. (Bug appears Mac-specific.)
I was trying to get datetime.py working as one of the functions from it just didn't exist in my datetime.py file. In my datetime.py the fromiso() function is not present in the code. To test it I opened a new VS project and tried compiling a small code snippet that would only invoke the missing function from datetime after import, and that's when I first encountered this problem. I'm not sure if this is related to this problem, but this is the last thing I was doing.
When running the code it will flash console quickly before opening "Launching debug adapter" window, this will prevent me from doing anything for maybe 10s and then will return to the starting point having neither executed my code nor opened the debugger.
Now I am unable to run any program whatsoever, running with either ctr+f5 or fn+f5 leads to same glitch. I have not touched anything in the VS settings prior. I have tried powercycling just for a good measure, but sadly that didn't fix anything. Running as admin yields same result.
I'm making a game using Ren'py (based on python) and most errors aren't shown, especially the errors in python code. Is there a possibility to check for possible errors at compile time and how do I get where some errors occur? If there are errors the game normally doesn't run or breaks at the a errors appearance without a message.Is there maybe a file, where they are written in or something like that? Or do I have to debug using logs everywhere?
Compile errors will be shown when you first try to compile the RPY files. They will be put in "errors.txt" in your project directory. Most errors are not found at compile-time, however, and will only show up once you encounter them at run-time.
You can use Lint to check for some common errors (It's called "Check Script (Lint)"), but mostly you'll have to playtest to ensure there are no errors. Errors during playback should pop up a gray screen showing the error and traceback with the option to Ignore, Rollback, or Quit. Is this screen not showing up for you?
If you're looking for some kind of intellisense like you have for some languages, where as you write the code the IDE shows errors, then it doesn't exist. You have to launch the game so that the code is compiled, just then Ren'py will show you errors. You can see them in the editor or in the errors.txt that Ren'Py creates. To test you python code you can launch the game and type Shift + O to open the console.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I have installed Python 2.7 (Windwos 7). However, I am unable to load the GUI. I get no response when I try to open. I re-installed it but again the same problem. What might be the solution?
If you have python in the default installation path, try in the windows shell:
C:\Python27\pythonw C:\Python27\Lib\idlelib\idle.pyw
or change the path accordingly. This should work even if you have other conflicting pythons in your installation or paths are not set.
If idle comes, best solution is to modify idle.bat (in idlelib
folder) with the above explicit paths and create a desktop direct access to that new .bat.
If idle doesn't come, try
starting idle as administrator
starting idle after shutting down windows firewall
There can be lot of reasons and its difficult to diagnosis and recommend a solution without looking into the actual system and process. If you are really interested to resolve this I can suggest how you can debug these issues.
Download Process Monitor
Bring up process Monitor and filter all process except pythonw. PythonW is the process that runs when you start IDLE.
Now Start Monitoring in Process Monitor.
Bring up IDLE and wait until Process Monitor's Log becomes stable.
Now study the LOG to see what might have gone wrong.
If you need more help, just post the log here and we can try to see what is wrong with your system.
Just to simulate your problem, I renamed my idle.pyw so idle_1.pyw and tried to bring up IDLE. It failed without any message. I then brought up process Monitor, and filtered the pythonw process and tried to bring up IDLE again. I found a message in the log which was in coherence with the problem.
As you can see, I have highlighted the error which shows what the error yes. Try the process explorer and this would surely nail down the problem if nothing works for you :-)
Remember, just search for ThreadExit in the log, the Error should be just above the Operation. In case its difficult for your to figure out the problem, just post the screan shot near the ThreadExit, and we can help you out.
Update from the Image Provided
As you can see in the log, the FSECURE.DLL closed the thread abruptly. FSECURE (Antivirus/Firewall) didn't think this process to have legitimate rights to do some operation. If you need to know more details as to what operation was blocked you would get from Fsecure Log. In most cases as you have experienced, running as an Administrator would help the process gain the right to not being blocked by Fsecure.
I have no expericne with Fsecure, but most antivirus have a Whitelist entry where if you add a process would prevent it from blocking it.
I had the same problem after installing python 3.3.2 on my Windows 7 Professional x64.
During the setup I had to provide administrator privileges due to turned on UAC. Ever after when trying to start the IDLE nothing would happen - unless I started it as an administrator.
I checked the setup but couldn't make out an option for a non-admin install as described in http://bit.ly/15WBouF.
Inspired by the comment of Joaquin from above I deleted the entire folder named .idlerc located at my user directory. Et voila - IDLE runs as a charm!
Althought the root of the problem is still unknown to me this solved my issue.
I had similar problem, IDLE would stay silent and crash after couple more tries.
Then I tried to run the code from command line: >>python program.py
the command line said that I had problem with global variables. You have to declare a variable global in the beginning ot everyfunction before reaching it:
var1
def func():
global var1
...code..
##end of func()
IDLE would not show that problem. It's a handy tool, but sometimes leaves you speechless.
In keeping with simplicity, may I suggest removing Python 2.7, and download the stable version without known IDLE issues. That'd be Python 3.3.3. Click here --> Python 3.3.3 Python 3.4.1. is problematic.
Please select 'Start' > 'Computer' > Right Click on 'Computer' > Select 'Properties'.
Select 'Environmental Variables'.
Select 'New' or 'Edit' Variables. Path of the python.exe. C:\Python33.
Either Edit or input new Variables with naming conventions. This should remedy any issues with IDLE. However, regarding the GUI - may I suggest the following: 5) In the Command Prompt, type: cd C:\Python33. This should take care of it. Hope this helps.