dfd-tud / deda

https://dfd.inf.tu-dresden.de
GNU General Public License v3.0
1.57k stars 92 forks source link

AttributeError: module 'numpy' has no attribute 'object'. #29

Closed p1r473 closed 2 weeks ago

p1r473 commented 5 months ago

FYI you need to edit /root/.local/lib/python3.11/site-packages/libdeda/privacy.py replace dtype=np.object) with dtype=object)

due to this error:

❯ deda_anonmask_create -r Image.png
/root/.local/lib/python3.11/site-packages/libdeda/privacy.py:143: FutureWarning: In the future `np.object` will be defined as the corresponding NumPy scalar.
  dtype=np.object)
Traceback (most recent call last):
  File "/root/.local/bin/deda_anonmask_create", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_anonmask_create.py", line 50, in <lambda>
    main = lambda:Main()()
                  ^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/deda_bin/deda_anonmask_create.py", line 43, in __call__
    mask = calibrationScan2Anonmask(fp.read(),self.args.copy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/privacy.py", line 273, in calibrationScan2Anonmask
    return AnonmaskCreator(imbin,verbose)(copy)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/privacy.py", line 104, in __call__
    self.restoreOrientation()
  File "/root/.local/lib/python3.11/site-packages/libdeda/privacy.py", line 150, in restoreOrientation
    contours = self._findContours(CYAN)
               ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.local/lib/python3.11/site-packages/libdeda/privacy.py", line 143, in _findContours
    dtype=np.object)
          ^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/numpy/__init__.py", line 324, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'object'.
`np.object` was a deprecated alias for the builtin `object`. To avoid this error in existing code, use `object` by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'object_'?    
p1r473 commented 5 months ago

Fixed here https://github.com/dfd-tud/deda/pull/30

timojuez commented 2 weeks ago

Thank you very much. Merged.