Chrispresso / SuperMarioBros-AI

332 stars 69 forks source link

PyQt crashes with exit code -1073740791 (0xC0000409) #2

Closed megargayu closed 3 years ago

megargayu commented 3 years ago

I was trying out your program in Pycharm, and the AI had run for about 1 minute after the window unexpectedly crashed and Pycharm said the program exited with code -1073740791 (0xC0000409). There wasn't even any error message! Could you explain (and possibly help me fix) why this is happening?

NOTE: This following part has nothing to do with the problem I suggest you enable High DPI settings so your program works with bigger resolutions. You only need three lines of code (as shown below)

from PyQt5 import QtGui, QtWidgets, QtCore # Added QtCore import
# Other code...
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True) #enable highdpi scaling
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) #use highdpi icons

(I got this code from here)

Chrispresso commented 3 years ago

@Programmer103 I don't think it's a PyQt issue. Based on some quick looking it seems like it could be related to either Windows https://stackoverflow.com/questions/50562192/process-finished-with-exit-code-1073740791-0xc0000409-pycharm-error or PyCharm itself. There are numerous cases online about PyCharm finishing with that error code. Can you try to run it from the command line instead of PyCharm and see what happens?

I can add code to support high DPI as well. Thanks for that suggestion!

megargayu commented 3 years ago

You're welcome for the suggestion :)

As for the issue, looks like it does work with command prompt instead of PyCharm. Thanks a lot!