Qt for Python/Considerations: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
Line 36: Line 36:
</syntaxhighlight>
</syntaxhighlight>
(Related: https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found/43504007#43504007 )
(Related: https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found/43504007#43504007 )
==== Missing QtScript ====
At the moment we do not provide a QtScript interface since most of the functionallity behind it is covered by Python nature, but we plan to include it in the future.
==== Issues using shiboken2 ====
We have notice that in some linux machines, the built-in shiboken2 does depend of Clang headers that could be not found depending on the Linux distribution.
We recommend to have a local PySide2 build when trying to generate bindings for any other c++ project.


==== Missing WebEngine in Windows 32bit package ====
==== Missing WebEngine in Windows 32bit package ====

Revision as of 08:12, 12 June 2018

General considerations

QString, QVariant and other types

Qt for Python does not provide access to QString and QVariant, meaning that we decided to use Python's native types for them. Internally we convert Python strings to QStrings and other types that could be accepted as QVariant, like dictionaries, lists and tuples.

Furthermore, the same idea is applied to QChar and QStringRef which are represented as Python strings and QStringList is converted to a Python lists of strings.

QDate, QDateTime, QTime, and QUrl's __hash__() methods return a string representation so that identical dates (and identical date/times or times or URLs) will have identical hash values. QTextStream's bin(), hex(), and oct() functions have been renamed bin_(), hex_(), and oct_(), to avoid conflicting with Python's built-ins of the same names.

Known issues

5.11

Problems with Python 3.6.0

There seems to be a binary compatibility between 3.6.0 and 3.6.1:

import 'PySide2' # <_frozen_importlib_external.SourceFileLoader object at 0x000001AB2E658F60>
Traceback (most recent call last):
  File "C:\Qt5\pyside-setup\examples\tutorial\t1.py", line 47, in <module>
    from PySide2 import QtWidgets
  File "<frozen importlib._bootstrap>", line 1009, in _handle_fromlist
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 648, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 560, in module_from_spec
  File "<frozen importlib._bootstrap_external>", line 922, in create_module
  File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
ImportError: DLL load failed: The specified procedure could not be found.
4628:4698 @ 1025492328 - LdrpReportError - ERROR: Locating export "PyUnicode_AsWideCharString" for DLL "C:\Dev\super_pyside_clang\py360_ap\lib\site-packages\PySide2\QtCore.pyd" failed with status: 0xc0000139

(Related: https://stackoverflow.com/questions/43264773/pil-dll-load-failed-specified-procedure-could-not-be-found/43504007#43504007 )

Missing QtScript

At the moment we do not provide a QtScript interface since most of the functionallity behind it is covered by Python nature, but we plan to include it in the future.

Issues using shiboken2

We have notice that in some linux machines, the built-in shiboken2 does depend of Clang headers that could be not found depending on the Linux distribution. We recommend to have a local PySide2 build when trying to generate bindings for any other c++ project.

Missing WebEngine in Windows 32bit package

This is a current limitation of Qt build itself, because the CI does not build any WebEngine libraries for 32 bit Windows. Thus Qt For Python does not ship WebEngine for 32 bit Windows packages.

Documentation

Most of the code snippets on the documentation are based on Qt/C++. It is probable that some pieces are still using C++, so the examples are invalid for Python. We are working to adapt them all, but if you need to understand a certain method or class, you can use our IRC channel to discuss your issue.