arguments did not match any overloaded call:
I'm trying to run an eye-tracking experiment on OpenSesame. However, when I try to run my experiment I get the following message:
TypeError: arguments did not match any overloaded call:
save(self, fileName: Optional[str], format: Optional[str] = None, quality: int = -1): argument 1 has unexpected type 'QBuffer'
save(self, device: Optional[QIODevice], format: Optional[str] = None, quality: int = -1): argument 1 has unexpected type 'QBuffer'
Running this same experiment in a different computer that has the same exact setup (I copied the virtual environment from one computer to the other) works just fine.
Any suggestions?
Comments
Hi @joao_craveiro ,
Can you post the full traceback (from the console) so that it's clear where the error originates?
— Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
I am getting the same error. Here is the traceback:
Traceback (most recent call last): File "/home/extra-laptop/.local/lib/python3.10/site-packages/opensesame_extensions/core/preload_items/preload_items.py", line 67, in _on_awake self._preload_one_item() File "/home/extra-laptop/.local/lib/python3.10/site-packages/opensesame_extensions/core/preload_items/preload_items.py", line 82, in _preload_one_item item.edit_widget() File "/home/extra-laptop/.local/lib/python3.10/site-packages/libqtopensesame/items/feedpad.py", line 73, in edit_widget self.sketchpad_widget.draw() File "/home/extra-laptop/.local/lib/python3.10/site-packages/libqtopensesame/widgets/sketchpad_widget.py", line 420, in draw element.draw() File "/home/extra-laptop/.local/lib/python3.10/site-packages/libqtopensesame/sketchpad_elements/_base_element.py", line 70, in draw self.graphics_item = super(base_element, self).draw() File "/home/extra-laptop/.local/lib/python3.10/site-packages/libopensesame/sketchpad_elements/_textline.py", line 53, in draw return self.canvas.text(properties[u'text'], File "/home/extra-laptop/.local/lib/python3.10/site-packages/libqtopensesame/misc/sketchpad_canvas.py", line 623, in text im = t._to_pil() File "/home/extra-laptop/.local/lib/python3.10/site-packages/openexp/_canvas/_richtext/richtext.py", line 243, in _to_pil im = self._qimage_to_pil(self._to_qimage()) File "/home/extra-laptop/.local/lib/python3.10/site-packages/openexp/_canvas/_richtext/richtext.py", line 223, in _qimage_to_pil return Image.fromqimage(self._to_qimage()) File "/home/extra-laptop/.local/lib/python3.10/site-packages/PIL/Image.py", line 3164, in fromqimage return ImageQt.fromqimage(im) File "/home/extra-laptop/.local/lib/python3.10/site-packages/PIL/ImageQt.py", line 81, in fromqimage im.save(buffer, "png") TypeError: arguments did not match any overloaded call: save(self, str, format: str = None, quality: int = -1): argument 1 has unexpected type 'QBuffer' save(self, QIODevice, format: str = None, quality: int = -1): argument 1 has unexpected type 'QBuffer'In my case, it started when I transferred the experiment to a new device (ubuntu) with a fresh opensesame install.
I get the same error while trying to set up an experiment with a tobii eyetracker.
The error occurs when I open opensesame (without actually running anything or opening my experiment).
(Anaconda installation of OpenSesame with python3.10).
The full traceback is the following:
Traceback (most recent call last):
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\opensesame_extensions\core\preload_items\preload_items.py", line 67, in _on_awake
self._preload_one_item()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\opensesame_extensions\core\preload_items\preload_items.py", line 82, in _preload_one_item
item.edit_widget()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\libqtopensesame\items\feedpad.py", line 73, in edit_widget
self.sketchpad_widget.draw()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\libqtopensesame\widgets\sketchpad_widget.py", line 420, in draw
element.draw()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\libqtopensesame\sketchpad_elements\_base_element.py", line 70, in draw
self.graphics_item = super(base_element, self).draw()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\libopensesame\sketchpad_elements\_textline.py", line 53, in draw
return self.canvas.text(properties[u'text'],
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\libqtopensesame\misc\sketchpad_canvas.py", line 623, in text
im = t._to_pil()
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\openexp\_canvas\_richtext\richtext.py", line 243, in _to_pil
im = self._qimage_to_pil(self._to_qimage())
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\openexp\_canvas\_richtext\richtext.py", line 223, in _qimage_to_pil
return Image.fromqimage(self._to_qimage())
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\PIL\Image.py", line 3164, in fromqimage
return ImageQt.fromqimage(im)
File "C:\Users\Behav2_Stim\anaconda3\envs\opensesame-py3\lib\site-packages\PIL\ImageQt.py", line 81, in fromqimage
im.save(buffer, "png")
TypeError: arguments did not match any overloaded call:
save(self, fileName: Optional[str], format: Optional[str] = None, quality: int = -1): argument 1 has unexpected type 'QBuffer'
save(self, device: Optional[QIODevice], format: Optional[str] = None, quality: int = -1): argument 1 has unexpected type 'QBuffer'
According to chatgpt the problem is the following:
"The error message you're seeing is related to the
PIL(Python Imaging Library) andPyQtintegration, specifically when trying to convert aQImageto aPIL.Imageobject. The problem arises when thesavemethod is called with aQBufferobject, which thesavemethod does not expect.".Unfortunately, I'm not sure how to solve it without trying to change the code that is being called from the scripts. I tried to update the PIL and pyqt5 packages, but that did not solve the problem.
I'm not entirely sure where this comes from, but it seems to be an incompatibility between PIL and PyQt. Can you check which versions your are running of PyQt, Pillow, and OpenSesame?
Check out SigmundAI.eu for our OpenSesame AI assistant!
PyQT: 5.15.10
QT: 5.15.2
Pillow: 10.3.0
OpenSesame: 4.0.27
Hi there,
Was this issue ever resolved? I am encountering a similar problem.
Matthew