Skip to content

Instantly share code, notes, and snippets.

@altendky
Created July 7, 2017 13:58
Show Gist options
  • Save altendky/a64a7094524c68734de6fb59727d67b0 to your computer and use it in GitHub Desktop.
Save altendky/a64a7094524c68734de6fb59727d67b0 to your computer and use it in GitHub Desktop.
sys.version: 3.6.1 (default, Apr 22 2017, 20:17:23)
[GCC 5.4.0 20160609]
sys.platform: linux
QT_VERSION_STR: 5.8.0
PYQT_VERSION_STR: 5.8.2
j.object(): <class 'dict'> {'a': <PyQt5.QtCore.QJsonValue object at 0x7ffb6a84df28>}
TypeError: 'QJsonValue' object is not iterable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "j.py", line 16, in <module>
j = PyQt5.QtCore.QJsonDocument(d)
SystemError: <class 'PyQt5.QtCore.QJsonDocument'> returned a result with an error set
import sys
import PyQt5.QtCore
print('sys.version:', sys.version)
print('sys.platform:', sys.platform)
print('QT_VERSION_STR:', PyQt5.QtCore.QT_VERSION_STR)
print('PYQT_VERSION_STR:', PyQt5.QtCore.PYQT_VERSION_STR)
d = {'a': 1}
j = PyQt5.QtCore.QJsonDocument(d)
d = j.object()
print('j.object(): {} {}'.format(type(d), d))
j = PyQt5.QtCore.QJsonDocument({k: v.toVariant() for k, v in d.items()})
j = PyQt5.QtCore.QJsonDocument(d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment