0
$\begingroup$

Rosanswers logo

I am very new to the field of ROS and have been following ROS tutorials to set environment and when I always run roscore it gets stuck at: ... logging to /home/shreshtha/.ros/log/6c27bb5a-9d87-11ed-ac12-9840bb3645e5/roslaunch-shreshtha-Vostro-4729.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt

and whenever I pess CTRL+C:

I get: Traceback (most recent call last): File "/opt/ros/melodic/bin/roscore", line 84, in roslaunch.main(['roscore', '--core'] + sys.argv[1:]) File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/init.py", line 347, in main p.start() File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/parent.py", line 301, in start self.logger.info("starting roslaunch parent run") File "/usr/lib/python3.11/logging/init.py", line 1489, in info self._log(INFO, msg, args, **kwargs) File "/usr/lib/python3.11/logging/init.py", line 1622, in _log fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/ros/melodic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 63, in findCaller while hasattr(f, "f_code"): ^^^^^^^^^^^^^^^^^^^^ KeyboardInterrupt ^CException ignored in atexit callback: <function _ros_atexit at 0x7ff128b6ff60> Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 615, in _ros_atexit signal_shutdown('atexit') File "/opt/ros/melodic/lib/python2.7/dist-packages/rospy/core.py", line 560, in signal_shutdown _logger.info("signal_shutdown [%s]"%reason) File "/usr/lib/python3.11/logging/init.py", line 1489, in info self._log(INFO, msg, args, **kwargs) File "/usr/lib/python3.11/logging/init.py", line 1622, in _log fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/ros/melodic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 66, in findCaller filename = os.path.normcase(co.co_filename) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 52, in normcase


Originally posted by shreshtha on ROS Answers with karma: 3 on 2023-01-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

I think Meolodic uses Python2 but it looks like you might be using a mix of Python3 and Python2. Was that intentional? I'm not brave enough to even install Python3 on the machine I have that runs old ROS.


Originally posted by billy with karma: 1850 on 2023-01-27

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by shreshtha on 2023-01-27:
Thank you for your response billy,actually I had to install python3 for another program that I was working and I think I messed up somewhere by installing it, are there any fixes available, shall I completely remove python3 from my system?

Comment by brean on 2023-01-27:
I am wondering how you managed to do this? I think you sourced a python3 environment into your python2 environment, so check your .bashrc-file as well as your path. If you just run "python -v" it should show you the python version that you use as default, that should be python2. Both python versions should be fine next to each other if you installed python from your package manager (like apt). But to help you uninstalling python3 might be the right fix you need, you probably also need to reinstall some python2 packages (at least the ones you installed after your python3 installation).

Comment by shreshtha on 2023-01-27:
Thanks Brean, upon typing "python -v" it's showing python3.11, and I think that is what is causing problem, so I will then uninstall python3 completely and get back to you.

Comment by shreshtha on 2023-01-28:
Thank you both of you after completely removing python3.11, I was able to run the roscore command

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.