Skip to content

Instantly share code, notes, and snippets.

@altendky
Created July 7, 2017 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save altendky/1fb546ea7a3baaaac1b22bdbf725ba8d to your computer and use it in GitHub Desktop.
Save altendky/1fb546ea7a3baaaac1b22bdbf725ba8d 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.9.1
PYQT_VERSION_STR: 5.9
j.object(): <class 'dict'> {'a': <PyQt5.QtCore.QJsonValue object at 0x7feeda36b748>}
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