RIPE-NCC / ripe-atlas-tools

Official command-line client for RIPE Atlas
GNU General Public License v3.0
183 stars 48 forks source link

Some strings printed as bytestrings in Python 3 #207

Closed oskar456 closed 4 years ago

oskar456 commented 6 years ago

The PR #185 has broken text output under Python 3. Please revert it and find a better solution – possibly without cheating in the unit tests. This is how current code works on Python 3:

$ ripe-atlas measurement-info 5001
b'\x1b[1mID                       \x1b[0m  5001'
b'\x1b[1mURL                      \x1b[0m  \x1b[36mhttps://atlas.ripe.net/measurements/50
01/\x1b[0m'
b'\x1b[1mType                     \x1b[0m  \x1b[34m\x1b[1mTraceroute\x1b[0m\x1b[0m'
b'\x1b[1mStatus                   \x1b[0m  Ongoing'
…

According to the unit tests patched in the same PR, this is expected output. Seriously?!

How can print(something.encode("utf-8")) result in anything else than printing a bytestring on Python 3?