You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you happen to typo the name of a method or attribute in your Python controller you get an error which appears to come from the Webots controller rather than your code.
Steps to Reproduce
fromcontrollerimportRobotRobot().oops
results in:
Traceback (most recent call last):
File "demo.py", line 3, in <module>
Robot().oops
File "/usr/local/webots/lib/controller/python36/controller.py", line 1701, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, Node, name)
File "/usr/local/webots/lib/controller/python36/controller.py", line 88, in _swig_getattr
return _swig_getattr_nondynamic(self, class_type, name, 0)
File "/usr/local/webots/lib/controller/python36/controller.py", line 83, in _swig_getattr_nondynamic
return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'
Expected behavior
While AttributeError is correct here, I would expect that it would have the proper name of the attribute which was being attempted to access (i.e: oops in the above).
System
Operating System: Ubuntu 18.04
Additional context
I'm not sure what the code in Webots' controller.py is trying to do, but as far as I can determine object.__getattr__ is always going to be an error -- there isn't a class method of that name in any version of Python.
If this is meant to always error, then a simple fix would be to change _swig_getattr_nondynamic like so:
Describe the Bug
If you happen to typo the name of a method or attribute in your Python controller you get an error which appears to come from the Webots controller rather than your code.
Steps to Reproduce
results in:
Expected behavior
While
AttributeError
is correct here, I would expect that it would have the proper name of the attribute which was being attempted to access (i.e:oops
in the above).System
Additional context
I'm not sure what the code in Webots'
controller.py
is trying to do, but as far as I can determineobject.__getattr__
is always going to be an error -- there isn't a class method of that name in any version of Python.If this is meant to always error, then a simple fix would be to change
_swig_getattr_nondynamic
like so:Alternatively, perhaps the function
getattr
is intended to be being used?The text was updated successfully, but these errors were encountered: