Important: Please read the Qt Code of Conduct -

Any access to QtCore through PySide2 causes errors with autocomplete, help(QtCore) causes fatal python error then crashes python

  • Hi all,

    this is my first time posting so go easy on me. Ive been using Qt for Python on and off for a few years however this is the first time I've had issues with QtCore.

    I'm using Python with windows 10: installed everything below from executable or through Pip
    Python: 3.8.2
    PySide2: v5.14
    PyQt5: v5.14
    Eclipse IDE with PyDev

    I am able to import from PySide2 any module required, and at runtime everything is per normal.

    However in my IDE the QtCore import throws a warning displaying "Unresolved Import:Qt, Slot etc etc" This is more of an annoyance than anything as it highlights half of my code with errors. I'm also unable to access the autocomplete for anything QtCore related.

    Things I've tried prior to asking for help:

    • uninstalled all other python versions to be sure it was grabbing the correct PySide2

    • updated PySide2 with pip yesterday

    • Installed PyQt5 to check QtCore there and that imports as expected with none of these issues described in this post.

    • I thought maybe it was an issue with my IDE so I ran Python 3.8.2 from CMD and attempted the import from there. A request for help(module) returns expected for all modules except QtCore where it gives me this error:

    Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from PySide2 import QtCore
    >>> help(QtCore)
    Traceback (most recent call last):
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\Lib\site-packages\shiboken2\files.dir\shibokensupport\signature\", line 105, in make_helptext
        return errorhandler.make_helptext(func)
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\Lib\site-packages\shiboken2\files.dir\shibokensupport\signature\", line 138, in make_helptext
        msg = sigtext + "\n\n" + existing_doc if existing_doc else sigtext
    TypeError: can only concatenate str (not "getset_descriptor") to str
    Fatal Python error: handle_doc did not receive a result
    Python runtime state: initialized
    Current thread 0x000031f8 (most recent call first):
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 613 in getdoc
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 95 in getdoc
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1240 in docclass
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 381 in document
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1178 in docmodule
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 380 in document
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1680 in render_doc
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1687 in doc
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1967 in help
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 1908 in __call__
      File "C:\Users\OEM\AppData\Local\Programs\Python\Python38\lib\", line 103 in __call__
      File "<stdin>", line 1 in <module>

    I thought maybe its an administrator restriction however running Python with administrator rights turned no results either.

    Any help would be greatly appreciated
    Cheers Jesse

  • Banned

    Note this could be an issue with the fact that PySide2 is not 100% current and is still lagging behind Qt and PyQt5 which are both current -- so unless you absolutely need that LGPL license versus the GPL one I would just use PyQt5

    Otherwise you could simply report this bug to the PySide2 developers they might have a temporary work around

  • Cheers for the reply Denni,

    I'll look through the bug reports for PySide2 and see if there's any mention of the above issue. A lot of the bugs there go over my head. Continuing with PyQt5 for now.

    Will report back with an answer if I find one.

  • Bug fixed PYSIDE-1272
    This will be included in and 5.15

    I rolled back my PySide2 version to 5.14.1 where this was still working.