Skip to content

Instantly share code, notes, and snippets.

@altendky altendky/j.out
Created Jul 7, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.