Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'bool' object has no attribute 'all' #69

Closed
Heath123 opened this issue Aug 10, 2021 · 11 comments
Closed

'bool' object has no attribute 'all' #69

Heath123 opened this issue Aug 10, 2021 · 11 comments

Comments

@Heath123
Copy link
Contributor

Exception has occurred: AttributeError
'bool' object has no attribute 'all'
  File "/home/heath/Downloads/abmatt/abmatt/converters/colors.py", line 143, in combine
    if (self.rgba_colors != color.rgba_colors).all():
  File "/home/heath/Downloads/abmatt/abmatt/converters/geometry.py", line 59, in combine
    self.colors.combine(geometry.colors, True)
  File "/home/heath/Downloads/abmatt/abmatt/converters/convert_dae.py", line 173, in __add_geometry
    if not geo[0].combine(geometry):
  File "/home/heath/Downloads/abmatt/abmatt/converters/convert_dae.py", line 198, in __parse_nodes
    self.__add_geometry(x, material_geometry_map)
  File "/home/heath/Downloads/abmatt/abmatt/converters/convert_dae.py", line 37, in load_model
    self.__parse_nodes(dae.get_scene(), material_geometry_map, matrix)
  File "/home/heath/Downloads/abmatt/abmatt/command.py", line 837, in run_convert
    mdl = converter.load_model(model)
  File "/home/heath/Downloads/abmatt/abmatt/command.py", line 769, in run_cmd
    return self.run_convert()
  File "/home/heath/Downloads/abmatt/abmatt/command.py", line 705, in run_commands
    cmd.run_cmd()
  File "/home/heath/Downloads/abmatt/abmatt/load_config.py", line 358, in parse_args
    if not Command.run_commands(cmds):
  File "/home/heath/Downloads/abmatt/abmatt/__main__.py", line 22, in main
    files = load_config.parse_args(argv, base_path)
  File "/home/heath/Downloads/abmatt/abmatt/__main__.py", line 29, in <module>
    main()

(this is using VS Code so the stacktrace is backwards from usual)

@Heath123
Copy link
Contributor Author

https://stackoverflow.com/a/59345651/4012708
So it seems this is only valid for numpy arrays but rgba_colors is a normal Python list

@Heath123
Copy link
Contributor Author

Also even if they were numpy arrays wouldn't this make it only return True if none of the elements are equal?

@Heath123
Copy link
Contributor Author

Heath123 commented Aug 10, 2021

Python 3.9.6 (default, Jul  3 2021, 16:40:50) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> a = np.array([1, 2, 3])
>>> b = np.array([1, 1, 1])
>>> c = (a == b)
>>> c
array([ True, False, False])
>>> c.all()
False
>>> 

Because this checks if all of them are True when you want to check if all of them are False (so if not (self.rgba_colors == color.rgba_colors).all(): would work in that case)

Heath123 added a commit to Heath123/abmatt that referenced this issue Aug 10, 2021
@Heath123
Copy link
Contributor Author

Heath123 commented Aug 11, 2021

Well the fix is wrong but now I can't reproduce the bug and I didn't attach an example file...

@Heath123
Copy link
Contributor Author

Never mind, reproduced it
model.zip

@Robert-N7
Copy link
Owner

I believe the desired behavior is to check if the two are equal. Because it may be either ndarray or a list, the best fix would be to check the length of the outside dimensions and use a for loop to compare each element if the lengths are equal.

@Heath123
Copy link
Contributor Author

Oh, they are both Numpy arrays, but comparing them can return a single boolean sometimes for some reason

@Heath123
Copy link
Contributor Author

@Robert-N7 My first thought was wrong, I assumed it was a list but it isn't

@Heath123
Copy link
Contributor Author

I narrowed down the problem at https://replit.com/@HeathMitchell1/nparray

@Heath123
Copy link
Contributor Author

@Heath123
Copy link
Contributor Author

Made a new PR: #71

Robert-N7 added a commit that referenced this issue Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants