Skip to content
This repository was archived by the owner on May 31, 2025. It is now read-only.

Make RospyLogger.findCaller compatible with Python3 (also, unbreak ROS on Python3)#1121

Merged
dirk-thomas merged 1 commit intoros:lunar-develfrom
kartikmohta:fix/roslogging-python3
Aug 11, 2017
Merged

Make RospyLogger.findCaller compatible with Python3 (also, unbreak ROS on Python3)#1121
dirk-thomas merged 1 commit intoros:lunar-develfrom
kartikmohta:fix/roslogging-python3

Conversation

@kartikmohta
Copy link
Copy Markdown
Contributor

Due to the change in #1043, ROS was broken on Python3. The findCaller function in Python3 logging module takes 2 arguments (including self) compared to only 1 (self) in Python2 and returns 4 values instead of 3 in Python2.

Without this patch, roscore doesn't even start:

$ roscore
... logging to /home/kartikmohta/.ros/log/30a1f112-78a5-11e7-bdaf-507b9d9f0576/roslaunch-nyx-23629.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

Traceback (most recent call last):
  File "/opt/ros/lunar_py3/lib/python3.6/site-packages/roslaunch/__init__.py", line 306, in main
    p.start()
  File "/opt/ros/lunar_py3/lib/python3.6/site-packages/roslaunch/parent.py", line 264, in start
    self.logger.info("starting roslaunch parent run")
  File "/usr/lib/python3.6/logging/__init__.py", line 1306, in info
    self._log(INFO, msg, args, **kwargs)
  File "/usr/lib/python3.6/logging/__init__.py", line 1430, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info)
TypeError: findCaller() takes 1 positional argument but 2 were given
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python3.6/logging/__init__.py", line 1430, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info)
TypeError: findCaller() takes 1 positional argument but 2 were given

The findCaller function in Python3 logging module takes 2 arguments (including self) compared to only self in Python2.
@dirk-thomas
Copy link
Copy Markdown
Member

@kartikmohta Thank you for the fix.

@asmodehn FYI

@dirk-thomas dirk-thomas merged commit 548cf9e into ros:lunar-devel Aug 11, 2017
@kartikmohta kartikmohta deleted the fix/roslogging-python3 branch August 11, 2017 23:29
@paulbovbel
Copy link
Copy Markdown
Contributor

FYI this is currently breaking ros1_bridge message generation, would kindly request a tagged release.

@dirk-thomas
Copy link
Copy Markdown
Member

A new release will be made as soon as the pending logging regression has been fixed: see #1141.

@dirk-thomas
Copy link
Copy Markdown
Member

The "broken" version should only be in the testing repo. You should be ok if you use the version available from the main repo.

@paulbovbel
Copy link
Copy Markdown
Contributor

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants