[tools] update parrot tools for python3 (#3326)

This commit is contained in:
Gautier Hattenberger
2024-07-03 11:14:52 +02:00
committed by GitHub
parent 8fa8415117
commit 4359117d16
3 changed files with 23 additions and 23 deletions
+12 -12
View File
@@ -225,19 +225,19 @@ class Ardrone2(ParrotUtils):
# Change the network ID
if args.command == 'networkid':
self.ardrone2_set_ssid(args.name)
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
if input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
self.reboot()
# Change the IP address
elif args.command == 'ipaddress':
self.ardrone2_set_ip_address(args.address)
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
if input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
self.reboot()
# Change the wifi mode
elif args.command == 'wifimode':
self.ardrone2_set_wifi_mode(args.mode)
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
if input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
self.reboot()
# Install and configure network
@@ -252,12 +252,12 @@ class Ardrone2(ParrotUtils):
print('=============================')
if self.check_wifi_setup():
print('Custom Wifi script already installed')
if raw_input("Shall I reinstall the Wifi script (y/N) ").lower() == 'y':
if input("Shall I reinstall the Wifi script (y/N) ").lower() == 'y':
self.ardrone2_install_network_script()
else:
if raw_input("Shall I install custom Wifi script (recommanded) (y/N) ").lower() == 'y':
if input("Shall I install custom Wifi script (recommanded) (y/N) ").lower() == 'y':
self.ardrone2_install_network_script()
if raw_input("Shall I install olsrd (ad-hoc wireless mesh routing deamon) (y/N) ").lower() == 'y':
if input("Shall I install olsrd (ad-hoc wireless mesh routing deamon) (y/N) ").lower() == 'y':
self.ardrone2_install_olsrd()
self.ardrone2_set_ssid(args.name)
self.ardrone2_set_ip_address(args.address)
@@ -272,14 +272,14 @@ class Ardrone2(ParrotUtils):
print('Channel:\t' + self.read_from_config('wifi_channel'))
print('==================================')
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
if input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
self.reboot()
# Install and configure autostart
elif args.command == 'install_autostart':
if self.check_autoboot():
print('Custom autostart script already installed')
if raw_input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
if input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
self.ardrone2_install_autoboot()
else:
self.ardrone2_install_autoboot()
@@ -287,7 +287,7 @@ class Ardrone2(ParrotUtils):
self.write_to_config('start_paparazzi', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)
if raw_input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
if input("Shall I restart the ARDrone 2? (y/N) ").lower() == 'y':
self.reboot()
# Change the autostart
@@ -300,7 +300,7 @@ class Ardrone2(ParrotUtils):
elif args.command == 'installvision':
if self.check_vision_installed():
print('Vision framework already installed')
if raw_input("Shall I reinstall the vision framework? (y/N) ").lower() == 'y':
if input("Shall I reinstall the vision framework? (y/N) ").lower() == 'y':
self.ardrone2_remove_vision()
self.ardrone2_install_vision()
@@ -314,7 +314,7 @@ class Ardrone2(ParrotUtils):
else:
if not self.check_vision_installed():
print('No vision framework installed')
if raw_input("Shall I install the vision framework? (y/N) ").lower() == 'y':
if input("Shall I install the vision framework? (y/N) ").lower() == 'y':
self.ardrone2_install_vision()
if self.check_vision_installed():
@@ -331,7 +331,7 @@ class Ardrone2(ParrotUtils):
else:
if not self.check_vision_installed():
print('Warning: No vision framework installed')
if raw_input("Warning: Shall I install the vision framework? (y/N) ").lower() == 'y':
if input("Warning: Shall I install the vision framework? (y/N) ").lower() == 'y':
self.ardrone2_install_vision()
if self.check_vision_installed():
+10 -10
View File
@@ -41,7 +41,7 @@ class Bebop(ParrotUtils):
self.config_content = self.execute_command('cat ' + self.config_file)
# Search for the name
search = re.search(name + '=([^\r\n\t ]+)',self.config_content)
search = re.search(name + '=([^\r\n\t ]+)', self.config_content)
if search is None:
return 'Unknown'
else:
@@ -196,13 +196,13 @@ class Bebop(ParrotUtils):
# Change the network ID
if args.command == 'networkid':
self.bebop_set_ssid(args.name)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Change the wifi mode
elif args.command == 'wifimode':
self.bebop_set_wifi_mode(args.mode)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Change the wifi mode
@@ -211,13 +211,13 @@ class Bebop(ParrotUtils):
print("Invalid address or dhcp option. Leaving.")
return
self.bebop_set_address(args.address)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Change the wifi encryption mode
elif args.command == 'wifikey':
self.bebop_set_wifi_key(args.amode, args.key)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Install and configure network
@@ -230,11 +230,11 @@ class Bebop(ParrotUtils):
return
if self.check_autoboot():
print('Custom autostart (and network) script already installed')
if raw_input("Shall I reinstall the autostart (and network) script (y/N) ").lower() == 'y':
if input("Shall I reinstall the autostart (and network) script (y/N) ").lower() == 'y':
self.bebop_install_scripts()
else:
print('Custom autostart (and network) script is required but is not installed')
if raw_input("Shall I reinstall the autostart (and network) script (y/N) ").lower() == 'y':
if input("Shall I reinstall the autostart (and network) script (y/N) ").lower() == 'y':
self.bebop_install_scripts()
else:
print('Scripts not installed, Leaving.')
@@ -248,14 +248,14 @@ class Bebop(ParrotUtils):
self.uav_status()
print('==================================')
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Install and configure autostart
elif args.command == 'install_autostart':
if self.check_autoboot():
print('Custom autostart script already installed')
if raw_input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
if input("Shall I reinstall the autostart script (y/N) ").lower() == 'y':
self.bebop_install_scripts()
else:
self.bebop_install_scripts()
@@ -263,7 +263,7 @@ class Bebop(ParrotUtils):
self.write_to_config('START_PPRZ', autorun[args.type])
print('The autostart on boot is changed to ' + args.type)
if raw_input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
if input("Shall I restart the Bebop? (y/N) ").lower() == 'y':
self.reboot()
# Change the autostart
+1 -1
View File
@@ -131,7 +131,7 @@ class ParrotUtils:
s = s[len(command) + 2:-12]
else:
s = s[len(command) + 2:-4]
return s
return s.decode()
# Upload ftp and catch memory-full error
def upload(self, filename, content):