39

I'm completly stuck on this. I keep getting error message

Process finished with exit code -1073741819 (0xC0000005)

I'm using pycharm with pyqt5.6 and qt5.6.2 and the problem started when I upgraded to these versions.

I've tried searching as much as I can, but have not been able to find an answer. Can anyone help please?

dieKoderin
  • 1,552
  • 3
  • 19
  • 39
A Rob4
  • 1,278
  • 3
  • 17
  • 35
  • 2
    that's the code for null pointer exception. – Jean-François Fabre May 31 '18 at 09:32
  • 5
    @ARob4. Exit codes are completely useless for debugging. Please learn how to configure your programming environment so that it displays the python traceback. Or run the code in a console or command window instead of IDE so you can see the output directly. – ekhumoro May 31 '18 at 10:21
  • @ekhumoro The Python interpreter is crashing with non-zero exit code when PyCharm/IntelliJ attempts to iterate properties. In this scenario, the Python interpreter does not provide an exception stack trace. It is possible that Linux could provide a `core` dump. – kevinarpe Nov 09 '21 at 12:34

10 Answers10

14

Assume you are running under Windows. Application Error code 0xc0000005, also known as Access Violation error, is a common problem experienced by Windows users, regardless of os version. There are various causes to trigger Application Error 0xc0000005. For my case, I'm running debug mode in PyCharm (or Eclipse) with code that includes the following:

from pympler import muppy
all_objects=muppy.get_objects()  # this causes pydev debugger exit with code -1073741819 (0xC0000005)

It was perfectly fine if execute the same piece of code through PyCharm in non-debug (Run) mode. Disabled the above code in debug mode, issue resolved.

Environment: PyCharm Community 2019.3, Anaconda 3, Python 3.7.3, pympler 0.7, Windows 10 Enterprise

Jonathan L
  • 9,552
  • 4
  • 49
  • 38
  • This was helpful, although not exactly what happened to me. I was getting the error both in 'debug' & 'run' mode in PyCharm, but it was definitely PyCharm that was causing the error. I ran the script from terminal and the error was gone. – Laguilhoat Aug 25 '22 at 09:31
6

I just ran into this error, and found it was caused by using a method from a newer version of Python than my venv was configured (match/case in 3.10.0 with 3.8 as the interpreter)

rktkt
  • 61
  • 1
  • 1
6

While developing SQLAlchemy application I run into the same issue.

I've added the -X dev (https://docs.python.org/3/using/cmdline.html#miscellaneous-options) Interpreter options in PyCharm Run/Debug Configurations which resulted in new exceptions instead of crashing with -1073741819 (0xc0000005). These exceptions did not appear before.

Raphael Bossek
  • 1,904
  • 14
  • 25
6

Use faulthandler it will show the stack trace when application crashes through which u can debug the issue

import faulthandler

if __name__ == "__main__":

    faulthandler.enable() #start @ the beginning

    ... # application logic
Udesh
  • 2,415
  • 2
  • 22
  • 32
5

Not sure if this is the 'right' way to do it but I ended up completely uninstalling anaconda and rebuilding it. When I then made a new virtual environment the problem resolved. If others have the same issue this might work too. By the way the problem first occurred with an update to pyqt5.

Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
A Rob4
  • 1,278
  • 3
  • 17
  • 35
  • Do you remember what solved your problem? I get the same error codes and I'm using PySide2 (now the official Python bindings for Qt 5). – HelloGoodbye Nov 10 '19 at 22:21
  • Yes, it wasn't anything to do my the code, it was due to problems finding the DLLs that were needed. The path environment variable wasn't pointing to the right place. Trial and error was all that worked! – A Rob4 Nov 12 '19 at 07:25
  • Okay. I had a completely weird problem, where if I assigned the pixmap from a `QImage` to a `QLabel`, with `setPixmap`, in the same function as I created the `QImage`, it would work fine, whereas if I created the `QImage` in one function, stored it, and then assigned its pixmap to the `QLabel` in another function, the script would crash and give me this error code during the call to `setPixmap`. I have no idea why this happened, but I simply made sure to have the `QImage` creation and the call to `setPixmap` in the same function because then it works. – HelloGoodbye Nov 12 '19 at 09:25
2

Same problem, this resolved in my case:

  • try run from command line (no pycharm), it works ( exception only in debug )
  • closed pycharm
  • deleted ".idea" folder inside project path
  • opened pycharm
  • reconfigure python runtime version and command line parameter
  • debug works
1

I had the same problem solve it by updating my tensorflow. There is probably some kind of compatibility problem. I realize the problem was from my "import tensorflow" because i was not getting an obvious error right after the import line.

dieKoderin
  • 1,552
  • 3
  • 19
  • 39
1

I encountered the same issue today. I found this question while Googling for an answer! By luck, I found the root cause in my code.

When I tried to expand a self pointer in the IntelliJ Python debugger, my Python interpreter would crash with: Process finished with exit code -1073741819 (0xC0000005)

Here is the code that caused the issue:

@property
def prop(self):
    return self.prop  # Facepalm: I meant to write: self._prop

When expanding self in the debugger, IntelliJ iterates all properties in the object. If there is infinite loop/recursion, the Python interpreter will crash.

kevinarpe
  • 20,319
  • 26
  • 127
  • 154
1

I had the same problem today when plotting a simple matrix. For me just changing the Python interpreter helped. I am not sure why, but I could imagine it has something to do with the installed libraries.

Marvin
  • 11
  • 2
0

I occasionally get this error when I use the boolean operation methods provided by the PyVista library. So, as far as I am concerned, this is not due to PyCharm but to PyVista (i.e. VTK) only (running the code from a terminal does not change the outcome).

As noted in this PyVista issue:

Boolean operations within VTK are prone to error [...].

Cleaning the mesh can prevent the occurrence of this error.

blunova
  • 2,122
  • 3
  • 9
  • 21