Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DLL load failed when importing PySide2, only while debugging

Im facing a strange issue. I have downloaded and installed the Qt for Python library (PySide2) in the virtual environment of my project in PyCharm. I have created a dummy GUI using the Qt Designer and Im loading (.ui file) and displaying the GUI through my python code. Whenever I run the code, I can see the GUI without errors. However, whenever I debug the code, I get an error:

File "...\gui_pyside2.py", line 5, in

from PySide2.QtWidgets import QApplication, QLabel, QLineEdit

ImportError: DLL load failed: The specified procedure could not be found.

Pydev crashes on this line:

#execute the script (note: it's important to compile first to have the filename set in debug mode)
exec(compile(contents+"\n", file, 'exec'), glob, loc)

Im pretty lost on what could be the cause. It seems like pydev is interfering with the imports? I have tried using import statements instead of from import but the problem persists. Any ideas?

Versions installed:

  • PyCharm Community 2018.1.4
  • pydev debugger (build 181.5087.37)
  • Python 3.6.6 (v3.6.6:4cf1f54eb7, Jun 27 2018, 03:37:03) [MSC v.1900 64 bit (AMD64)]
  • PySide2-5.11.1a1.dev1530373667-5.11.1.dist (technical preview, python binding to Qt 5.11)
like image 676
capitan Avatar asked Jan 18 '26 09:01

capitan


1 Answers

Answering to my own question:

Turns out there's a compatibility setting in Pycharm for Pyside:

PySide compatibility

Set it to PySide and debugger runs.

like image 60
capitan Avatar answered Jan 20 '26 02:01

capitan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!