ElectricRCAircraftGuy / eRCaGuy_dotfiles

.bashrc file, terminal prompt that shows current git branch, Arduino setup, Eclipse setup, git diff with line numbers, helpful scripts, improved Linux productivity, etc.
MIT License
204 stars 60 forks source link

Adjust string formatter to support python2.7 #19

Open mxterry opened 2 years ago

mxterry commented 2 years ago

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: https://github.com/ElectricRCAircraftGuy/eRCaGuy_dotfiles/blob/e83a66b0bf6c07b03a55dd02d33f701549601db3/useful_scripts/ros_readbagfile.py#L80

see my pull request later.

ElectricRCAircraftGuy commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

@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.