<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hallo,</div>
<div> </div>
<div>I think there is a bug regarding the use of QPolygon with pickel. Due to documentation (http://pyqt.sourceforge.net/Docs/PyQt5/pickle.html) using pickle with QPolygon is supported but I get an error. </div>
<div> </div>
<div>I posted the following request on stackoverflow (please see https://stackoverflow.com/questions/54928431/pickle-a-qpolygon-in-python-3-6-and-pyqt5) and was asked to write a bug report.</div>
<div> </div>
<div>Here the following request from stackoverflow including a simple example:</div>
<div>
<p>I try to pickle a QPolygon and load it afterwards, but I get an error. I have done this on Python2 with PyQt4 but want to use it now on Python3 with PyQt5.</p>
<p>I do not want to read/load data generated with Python 2! The pickle file is simply used to temporarily store Qt-elements like QPolygons from Python3 to Python3.</p>
<p>I have tested different protocol options from 1-4 for pickle.dump() and tried to use the "fix_imports=True" option which should not make a difference in Python3.</p>
<p>Here is my simplified code:</p>
<pre><code>#####################################
from PyQt5.QtGui import QPolygon
from PyQt5.QtCore import QPoint
import pickle
file_name = "test_pickle.chip"
with open(file_name, 'wb') as f:
poly = QPolygon((QPoint(1, 1), QPoint(2, 2)))
pickle.dump(poly, f, protocol=2) # , fix_imports=True)
# loading the data again
with open(file_name, 'rb') as f:
elem = pickle.load(f, encoding='bytes') # , fix_imports=True)</code></pre>
<div><code>#####################################</code></div>
<div> </div>
<div> </div>
<div>I get the following error message but can't do anything with it:</div>
<div>
<pre><code>elem = pickle.load(f, encoding='bytes') # , fix_imports=True)
TypeError: index 0 has type 'int' but 'QPoint' is expected</code></pre>
<div> </div>
<div> </div>
<div> </div>
<div>Is there maybe any alternative to pickle which can be used to easily store different types of data like strings, QPolygones and so on?</div>
<div> </div>
<div>Many thanks in advance,</div>
<div>BR,</div>
<div>HoWil</div>
</div>
</div></div></body></html>