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

Adjust string formatter to support python2.7 #19

Open
mxterry opened this issue Mar 10, 2022 · 6 comments
Open

Adjust string formatter to support python2.7 #19

mxterry opened this issue Mar 10, 2022 · 6 comments

Comments

@mxterry
Copy link

mxterry commented Mar 10, 2022

In many of my workstation with ROS, there only ros-lib of python2.7 is pre-installed, and it's hard to install ros for py3 without internet connection.

In fact, to support python2.7, it needs simply back to using format() instead of f-string here:

help = textwrap.dedent(f"""

see my pull request later.

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Mar 10, 2022

Are you able to download bagpy manually (https://pypi.org/project/bagpy/#files), copy it to those machines with a USB thumb drive, and then use the ros_readbagfile.py program as-is?

I really don't want to cater to Python2 considering Python3 has been out since 2008 and Python2 was deprecated completely in 2020.

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Mar 10, 2022

You don't need all of ROS for python 3, just the rosbag module I think. I think sudo pip3 install bagpy is how I got that for myself.

@ElectricRCAircraftGuy
Copy link
Owner

A few notes to summarize what I'm saying clearly:

  1. I do not want to make the code Python 2 compatible. That's going backwards.
  2. I do want to help you get it to meet your needs, however. Ideally I'd like to help you get whatever Python 3 files you need to make that happen. I want you to be able to run the code. I don't think you're missing much to make that happen, but I don't have a solution right now. I think if you are able to get my script to your computers which don't have internet, however, then certainly you can get a few more files there too to make my script run in Python 3 for you.
  3. I'm not a python nor ROS packaging expert and I don't know the solution, but I think with working together and figuring things out we can find a better solution than making code Python 2 compatible.

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Mar 20, 2022

If anyone is curious, here is the last Python2 version of ros_readbagfile.py (from commit 3a2275430f3d7c002dbfc608a3d091b2beffcf63) just before I upgraded it from Python 2 to Python 3: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/3a2275430f3d7c002dbfc608a3d091b2beffcf63/useful_scripts/ros_readbagfile.py

So, that version above runs in Python2.

@mxterry
Copy link
Author

mxterry commented Mar 23, 2022

Ok, I undersand your opinion on Python2. And in fact, I am personnally agree with it.

I'll try your solution of making the script run with python3.

@ElectricRCAircraftGuy
Copy link
Owner

ElectricRCAircraftGuy commented Mar 23, 2022

@mxterry , thanks. If/when you get it working, please do return here and post a comment explaining how you solved the problem and got things installed to get it running. That will help you in the future, next time you have to do it again, as well as other people with the same problem.

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

No branches or pull requests

2 participants