diff --git a/src/dynamic_graph/entity.py b/src/dynamic_graph/entity.py index 37a09973a212f306903e921a9ee9ddadb132d8ad..7b140da47fb08409fba5eddb171c6d25d6381573 100644 --- a/src/dynamic_graph/entity.py +++ b/src/dynamic_graph/entity.py @@ -155,7 +155,7 @@ class Entity (object) : try: object.__getattr__(self, name) except AttributeError: - raise AttributeError('Entity named "%s" has no attribute %s\n'% + raise AttributeError("'%s' entity has no attribute %s\n"% (self.name, name)+ ' entity attributes are usually either\n'+ ' - commands,\n'+ diff --git a/src/entity-py.cc b/src/entity-py.cc index c6d8ab0e41ffb1d466dcd2baa2328d8319d3f6a0..0744a3ec37fc373f2cab20cd076048f07e0757fd 100644 --- a/src/entity-py.cc +++ b/src/entity-py.cc @@ -207,9 +207,10 @@ namespace dynamicgraph { entity->getNewStyleCommandMap(); if (commandMap.count(std::string(commandName)) != 1) { - std::string msg = "command " + std::string(commandName) + - " is not referenced in Entity " + entity->getName(); - PyErr_SetString(dgpyError, msg.c_str()); + std::ostringstream oss; + oss << "'" << entity->getName() << "' entity has no command '" + << commandName << "'."; + PyErr_SetString(PyExc_AttributeError, oss.str().c_str()); return NULL; } Command* command = commandMap[std::string(commandName)];