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

Logging error when running Python Updater in verbose == True mode #306

Closed
KevinSchwarzer opened this issue Jun 26, 2023 · 1 comment · Fixed by #307
Closed

Logging error when running Python Updater in verbose == True mode #306

KevinSchwarzer opened this issue Jun 26, 2023 · 1 comment · Fixed by #307
Assignees

Comments

@KevinSchwarzer
Copy link
Contributor

I ran into an error in diagnostic_updater/diagnostic_updater/_diagnostic_updater.py when setting Updater.verbose to True. I get the following error.

Traceback (most recent call last):
File "/workspaces/humble/install/argos_supervisor_py/lib/argos_supervisor_py/supervisor", line 33, in <module>
  sys.exit(load_entry_point('argos-supervisor-py', 'console_scripts', 'supervisor')())
File "/workspaces/humble/build/argos_supervisor_py/argos_supervisor_py/supervisor_node.py", line 280, in main
  executor.spin()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 279, in spin
  self.spin_once()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 764, in spin_once
  self._spin_once_impl(timeout_sec)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 761, in _spin_once_impl
  future.result()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 94, in result
  raise self.exception()
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
  self._handler.send(None)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 418, in handler
  await call_coroutine(entity, arg)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 332, in _execute_timer
  await await_or_execute(tmr.callback)
File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
  return callback(*args)
File "/workspaces/humble/install/diagnostic_updater/local/lib/python3.10/dist-packages/diagnostic_updater/_diagnostic_updater.py", line 279, in update
  'Non-zero diagnostic status. Name: %s, status\
TypeError: %i format: a real number is required, not bytes

The issue is within the following lines.

self.node.get_logger().warn(
'Non-zero diagnostic status. Name: %s, status\
%i: %s' % (status.name, status.level,
status.message))

Because status.level is a byte, but %i requires a number. Explicitly converting the byte to a string and using %s would fix this issue.

I'm more than happy to open a PR with these changes 😄

@ct2034
Copy link
Collaborator

ct2034 commented Jun 26, 2023

Thanks for reporting this and for the pr :)

@ct2034 ct2034 self-assigned this Jun 26, 2023
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

Successfully merging a pull request may close this issue.

2 participants