rosservice: #1759 convert empty command-line args to empty string

This commit is contained in:
Ken Conley 2009-09-22 01:22:29 +00:00
parent c8644da56c
commit 539eb9e4d1
1 changed files with 5 additions and 0 deletions

View File

@ -340,6 +340,8 @@ def call_service(service_name, service_args, service_class=None):
try:
return request, rospy.ServiceProxy(service_name, service_class)(request)
except rospy.ServiceException, e:
raise ROSServiceException(str(e))
except rospy.ROSSerializationException, e:
raise ROSServiceException("Unable to send request. One of the fields has an incorrect type:\n"+\
" %s\n\nsrv file:\n%s"%(e, rosmsg.get_srv_text(service_class._type)))
@ -486,6 +488,9 @@ def rosservice_cmd_call(argv):
# type-case using YAML
service_args = []
for arg in args[1:]:
# convert empty args to YAML-empty strings
if arg == '':
arg = "''"
service_args.append(yaml.load(arg))
if not service_args and has_service_args(service_name, service_class=service_class):
for service_args in _stdin_yaml_arg():