szafranski / RH-ota

Software, plans, instructions and resources for RotorHazard OTA Manager and Updater.
https://www.instructables.com/id/RotorHazard-Updater/
8 stars 5 forks source link

Codec encoding error when printing formatted #244

Open beedlitzer opened 2 years ago

beedlitzer commented 2 years ago

Configuration wizzard ran fine. Selecting the #1 Rotorhazard manager from the man menu of ota.sh gives me the following error:

Traceback (most recent call last): File "/home/pi/RH-ota/start_ota.py", line 33, in main() File "/home/pi/RH-ota/start_ota.py", line 29, in main update.main() File "/home/pi/RH-ota/update.py", line 547, in main main_menu(config) File "/home/pi/RH-ota/update.py", line 518, in main_menu rpi_update(config) File "/home/pi/RH-ota/rpi_update.py", line 281, in main_window print(welcome_text) UnicodeEncodeError: 'latin-1' codec can't encode character '\U0001f44d' in position 969: ordinal not in range(256)

I was able to get by this by changing line 377 in rpi_update.py to

print(welcome_text.encode('utf-8')) - but this negates the nice formatting

This also happens in other places

... ... port forwarding added - server available on default port 80 no need to type server port number in a browser address bar just type RotorHazard server IP address (probably: 10.0.0.54) (services that run on port 80 are available on port 8080 now)Traceback (most recent call last): File "/home/pi/RH-ota/start_ota.py", line 33, in main() File "/home/pi/RH-ota/start_ota.py", line 29, in main update.main() File "/home/pi/RH-ota/update.py", line 547, in main main_menu(config) File "/home/pi/RH-ota/update.py", line 518, in main_menu rpi_update(config) File "/home/pi/RH-ota/rpi_update.py", line 362, in main_window update(config) File "/home/pi/RH-ota/rpi_update.py", line 240, in update end_update(config, config_flag, server_installed_flag) File "/home/pi/RH-ota/rpi_update.py", line 103, in end_update print(show_update_completed()) UnicodeEncodeError: 'latin-1' codec can't encode characters in position 169-171: ordinal not in range(256)


Env information: RBP 4 B with 8GB memory

pi@Rotorhazard:~/RH-ota $ python --version Python 3.9.2

pi@Rotorhazard:~/RH-ota $ more updater-config.json { "pi_user": "pi", "rh_version": "main", "country": "GB", "nodes_number": 8, "gpio_reset_pin": false, "port_name": "ttyS0", "debug_mode": false, "debug_user": "default", "old_hw_mod": false, "pins_assignment": "default", "i2c_bus_number": 1, "beta_tester": false }

pi@Rotorhazard:~/RH-ota $ more /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)" NAME="Raspbian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"