PyQt5 script got error BEX in module StackHash

2019-07-25 17:29发布

问题:

I wrote script in Python 3.5 using PyQt5 and 2 my colleagues could not run it - they got error:

Problem signature:
  Problem Event Name:                    BEX
  Application Name:                      python.exe
  Application Version:                   3.5.1150.1013
  Application Timestamp:                 566391f0
  Fault Module Name:                     StackHash_0a9e
  Fault Module Version:                  0.0.0.0
  Fault Module Timestamp:                00000000
  Exception Offset:                      00000000
  Exception Code:                        c0000005
  Exception Data:                        00000008
  OS Version:                            6.1.7601.2.1.0.256.4
  Locale ID:                             1029
  Additional Information 1:              0a9e
  Additional Information 2:              0a9e372d3b4ad19135b953a78882e789
  Additional Information 3:              0a9e
  Additional Information 4:              0a9e372d3b4ad19135b953a78882e789

When script executed first Qt function:

app = QtWidgets.QApplication(sys.argv)

回答1:

Unfortunately I do not have error on my PC so I could not reproduce. But my colleague found a solution. He need to clean up imports. Originally I imported 2 similar packages:

from PyQt5.QtGui import QTextCursor, QFont
from PyQt5.Qt import QTextCursor, QFont

And issue was fixed when my colleague commented second line:

from PyQt5.QtGui import QTextCursor, QFont
#from PyQt5.Qt import QTextCursor, QFont

So if ever you got report of similar error try to clean up your imports...



标签: python pyqt5