makehuman
makehuman copied to clipboard
unexpected type 'float' when rendering
On Debian testing with the latest version from the master branch I see the following error when rendering:
Rendering at 800x600
Exception during event onClicked
Traceback (most recent call last):
File "/home/mneilly/OSS/makehuman/makehuman/./core/events3d.py", line 211, in callEvent
method(event)
File "/home/mneilly/OSS/makehuman/makehuman/plugins/4_rendering_opengl/__init__.py", line 125, in onClicked
mh2opengl.Render(settings)
File "/home/mneilly/OSS/makehuman/makehuman/plugins/4_rendering_opengl/mh2opengl.py", line 111, in Render
img = img.resized(width/2, height/2, filter=image.FILTER_BILINEAR)
File "/home/mneilly/OSS/makehuman/makehuman/./lib/image.py", line 217, in resized
return Image(data=self.resized_(width, height, filter))
File "/home/mneilly/OSS/makehuman/makehuman/./lib/image.py", line 213, in resized_
return image_qt.resized(self, width, height, filter=filter)
File "/home/mneilly/OSS/makehuman/makehuman/./lib/image_qt.py", line 129, in resized
qi = qi.scaled(QtCore.QSize(width, height),
TypeError: arguments did not match any overloaded call:
QSize(): too many arguments
QSize(int, int): argument 1 has unexpected type 'float'
QSize(QSize): argument 1 has unexpected type 'float'
The following change seems to get around this issue:
diff --git a/makehuman/lib/image_qt.py b/makehuman/lib/image_qt.py
index 25bc190e..82dce6da 100644
--- a/makehuman/lib/image_qt.py
+++ b/makehuman/lib/image_qt.py
@@ -126,7 +126,7 @@ def resized(img, width, height, filter=0):
transform = QtCore.Qt.SmoothTransformation
else:
transform = QtCore.Qt.FastTransformation
- qi = qi.scaled(QtCore.QSize(width, height),
+ qi = qi.scaled(QtCore.QSize(int(width), int(height)),
transformMode=transform)
return load(qi)
$ git rev-parse HEAD
e9dcf887c26310b85e06f44ac025d8937a72fbcd
$ python --version
Python 3.10.4
$ pip list
Package Version
---------- -------
numpy 1.22.4
pip 22.1.2
PyOpenGL 3.1.6
PyQt5 5.15.6
PyQt5-Qt5 5.15.2
PyQt5-sip 12.10.1
setuptools 62.1.0
wheel 0.37.1
@ Devs: I think we addressed this with the work on #198?
My guess is that this is one we missed when we went from python 2 ot python 3:
File "/home/mneilly/OSS/makehuman/makehuman/plugins/4_rendering_opengl/mh2opengl.py", line 111, in Render
img = img.resized(width/2, height/2, filter=image.FILTER_BILINEAR)
This should probably have been changed to img = img.resized(width//2, height//2, filter=image.FILTER_BILINEAR)
when we went to python 3. Nothing wrong with OP's work-around because it can fix other "missees" by being explicit, but maybe we should correct the integer division as well.
Probably fixed.