makehuman icon indicating copy to clipboard operation
makehuman copied to clipboard

Replace deprecated fromstring with frombuffer

Open StanleySweet opened this issue 3 weeks ago • 1 comments

I tried to run it on macOS today and got this error:

(venv) stan@MacBook-Pro-de-Stanislas makehuman % python3 makehuman/makehuman.py 
MakeHuman Copyright (C) 2001-2020 http://www.makehumancommunity.org
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. For details use the option --license

error: No module named 'getpath'
Traceback (most recent call last):
  File "/Users/stan/Dev/makehuman/makehuman/makehuman.py", line 581, in main
    make_user_dir()
    ~~~~~~~~~~~~~^^
  File "/Users/stan/Dev/makehuman/makehuman/makehuman.py", line 192, in make_user_dir
    import getpath
ModuleNotFoundError: No module named 'getpath'

This seems to be a false positive because it doesn't support being ran from outside. This one however is not. This PR adresses that.

(venv) stan@MacBook-Pro-de-Stanislas makehuman % cd makehuman 
(venv) stan@MacBook-Pro-de-Stanislas makehuman % python3 makehuman.py          
MakeHuman Copyright (C) 2001-2020 http://www.makehumancommunity.org
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions. For details use the option --license

Traceback (most recent call last):
  File "/Users/stan/Dev/makehuman/makehuman/lib/qtui.py", line 301, in initializeGL
    gl.OnInit()
    ~~~~~~~~~^^
  File "/Users/stan/Dev/makehuman/makehuman/lib/glmodule.py", line 365, in OnInit
    TEX_NOT_FOUND = getTexture(NOTFOUND_TEXTURE)
  File "/Users/stan/Dev/makehuman/makehuman/lib/texture.py", line 246, in getTexture
    img = Image(path=path)
  File "/Users/stan/Dev/makehuman/makehuman/lib/image.py", line 100, in __init__
    self._data = image_lib.load(path)
                 ~~~~~~~~~~~~~~^^^^^^
  File "/Users/stan/Dev/makehuman/makehuman/lib/image_qt.py", line 64, in load
    pixels = np.fromstring(pixels, dtype=np.uint32).reshape((h, w))
             ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: The binary mode of fromstring is removed, use frombuffer instead
[1]    35294 abort      python3 makehuman.py

StanleySweet avatar Dec 06 '25 11:12 StanleySweet

I couldn't launch it in Linux without this commit. Thanks!

esuriddick avatar Dec 19 '25 17:12 esuriddick