# HG changeset patch
# User Jaroslav Škarvada <jskarvad@redhat.com>
# Date 1589482736 -7200
#      Thu May 14 20:58:56 2020 +0200
# Branch py3
# Node ID 82c1e35f0f2fb13b57f024a0c2c3fe3e82dfff41
# Parent  68534f20c1418ae8e4cc09f3ff468d0375ba843a
Some python3 fixes Fixes #7877

diff -r 68534f20c141 -r 82c1e35f0f2f chirp/directory.py
--- a/chirp/directory.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/directory.py	Thu May 14 20:58:56 2020 +0200
@@ -126,7 +126,7 @@
     if image_file.startswith("rfinder://") and False:
         _, _, email, passwd, lat, lon, miles = image_file.split("/")
         rf = rfinder.RFinderRadio(None)
-        rf.set_params((float(lat), float(lon)), int(miles), email, passwd)
+        rf.set_params(float(lat), float(lon), int(miles), email, passwd)
         return rf
 
     if os.path.exists(image_file) and icf.is_icf_file(image_file):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/alinco.py
--- a/chirp/drivers/alinco.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/alinco.py	Thu May 14 20:58:56 2020 +0200
@@ -199,7 +199,7 @@
             self._mmap = self._download(self._memsize)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -208,7 +208,7 @@
             self._upload(self._memsize)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def get_raw_memory(self, number):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/anytone.py
--- a/chirp/drivers/anytone.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/anytone.py	Thu May 14 20:58:56 2020 +0200
@@ -177,7 +177,7 @@
     try:
         radio.pipe.write(data)
         radio.pipe.read(len(data))
-    except Exception, e:
+    except Exception as e:
         LOG.error("Error writing to radio: %s" % e)
         raise errors.RadioError("Unable to write to radio")
 
@@ -185,7 +185,7 @@
 def _read(radio, length):
     try:
         data = radio.pipe.read(length)
-    except Exception, e:
+    except Exception as e:
         LOG.error("Error reading from radio: %s" % e)
         raise errors.RadioError("Unable to read from radio")
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/anytone_ht.py
--- a/chirp/drivers/anytone_ht.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/anytone_ht.py	Thu May 14 20:58:56 2020 +0200
@@ -233,7 +233,7 @@
 def _echo_write(radio, data):
     try:
         radio.pipe.write(data)
-    except Exception, e:
+    except Exception as e:
         LOG.error("Error writing to radio: %s" % e)
         raise errors.RadioError("Unable to write to radio")
 
@@ -241,7 +241,7 @@
 def _read(radio, length):
     try:
         data = radio.pipe.read(length)
-    except Exception, e:
+    except Exception as e:
         LOG.error("Error reading from radio: %s" % e)
         raise errors.RadioError("Unable to read from radio")
 
@@ -930,7 +930,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ap510.py
--- a/chirp/drivers/ap510.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ap510.py	Thu May 14 20:58:56 2020 +0200
@@ -380,7 +380,7 @@
             data = download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
         # _mmap isn't a Chirp MemoryMap, but since AP510Memory implements
@@ -398,7 +398,7 @@
             upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def load_mmap(self, filename):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/baofeng_common.py
--- a/chirp/drivers/baofeng_common.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/baofeng_common.py	Thu May 14 20:58:56 2020 +0200
@@ -164,8 +164,8 @@
         try:
             data = _do_ident(radio, magic)
             return data
-        except errors.RadioError, e:
-            print e
+        except errors.RadioError as e:
+            print(e)
             error = e
             time.sleep(2)
     if error:
@@ -336,7 +336,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             # If anything unexpected happens, make sure we raise
             # a RadioError and log the problem
             LOG.exception('Unexpected error during upload')
@@ -622,7 +622,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
@@ -636,6 +636,6 @@
                     value = int(val.get_value() * 10)
                 LOG.debug("Setting fm_presets = %s" % (value))
                 self._memobj.fm_presets = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/baofeng_uv3r.py
--- a/chirp/drivers/baofeng_uv3r.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/baofeng_uv3r.py	Thu May 14 20:58:56 2020 +0200
@@ -51,7 +51,7 @@
     for _i in range(0, 10):
         try:
             return _uv3r_prep(radio)
-        except errors.RadioError, e:
+        except errors.RadioError as e:
             time.sleep(1)
 
     raise e
@@ -64,7 +64,7 @@
         return do_download(radio, 0x0000, 0x0E40, 0x0010)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 
@@ -75,7 +75,7 @@
         return do_upload(radio, 0x0000, 0x0E40, 0x0010)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 
@@ -623,7 +623,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
@@ -639,7 +639,7 @@
                 LOG.debug("Setting fm_presets[%1i] = %s" % (index, value))
                 setting = self._memobj.fm_presets
                 setting[index] = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/bf-t1.py
--- a/chirp/drivers/bf-t1.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/bf-t1.py	Thu May 14 20:58:56 2020 +0200
@@ -225,7 +225,7 @@
 
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Error sending Magic to radio:\n%s" % e)
 
 
@@ -561,7 +561,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Error: %s" % e)
 
     def _decode_tone(self, val, inv):
@@ -894,7 +894,7 @@
                     setattr(_settings, name, value)
 
                 LOG.debug("Setting %s: %s" % (name, value))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/bj9900.py
--- a/chirp/drivers/bj9900.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/bj9900.py	Thu May 14 20:58:56 2020 +0200
@@ -178,7 +178,7 @@
             self._mmap = self._clone_in()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -187,7 +187,7 @@
             self._clone_out()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def process_mmap(self):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/bjuv55.py
--- a/chirp/drivers/bjuv55.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/bjuv55.py	Thu May 14 20:58:56 2020 +0200
@@ -647,6 +647,6 @@
                 value = int(val.get_value() * 10 - 870)
                 LOG.debug("Setting fm_preset = %s" % (value))
                 self._memobj.fm_preset = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/fd268.py
--- a/chirp/drivers/fd268.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/fd268.py	Thu May 14 20:58:56 2020 +0200
@@ -790,11 +790,11 @@
                         obj = getattr(_mem, sett)
                         setattr(obj, name, element.value)
 
-                    except AttributeError, e:
+                    except AttributeError as e:
                         m = "Setting %s is not in this setting block" % name
                         LOG.debug(m)
 
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft1d.py
--- a/chirp/drivers/ft1d.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft1d.py	Thu May 14 20:58:56 2020 +0200
@@ -1890,7 +1890,7 @@
                 except AttributeError as e:
                     LOG.error("Setting %s is not in the memory map: %s" %
                               (element.get_name(), e))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft2800.py
--- a/chirp/drivers/ft2800.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft2800.py	Thu May 14 20:58:56 2020 +0200
@@ -201,7 +201,7 @@
             self._mmap = _download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Downloaded in %.2f sec" % (time.time() - start))
         self.process_mmap()
@@ -214,7 +214,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Uploaded in %.2f sec" % (time.time() - start))
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft2900.py
--- a/chirp/drivers/ft2900.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft2900.py	Thu May 14 20:58:56 2020 +0200
@@ -537,7 +537,7 @@
             self._mmap = _download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Downloaded in %.2f sec" % (time.time() - start))
         self.process_mmap()
@@ -549,7 +549,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Uploaded in %.2f sec" % (time.time() - start))
 
@@ -1210,7 +1210,7 @@
                     setattr(_settings, name, value)
 
                 LOG.debug("Setting %s: %s" % (name, value))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft450d.py
--- a/chirp/drivers/ft450d.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft450d.py	Thu May 14 20:58:56 2020 +0200
@@ -499,7 +499,7 @@
             self._mmap = self._clone_in()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s"
                                     % e)
         self.process_mmap()
@@ -509,7 +509,7 @@
             self._clone_out()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s"
                                     % e)
 
@@ -1489,6 +1489,6 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft50.py
--- a/chirp/drivers/ft50.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft50.py	Thu May 14 20:58:56 2020 +0200
@@ -586,7 +586,7 @@
 def _clone_out(radio):
     try:
         return __clone_out(radio)
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with the radio: %s" % e)
 
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft60.py
--- a/chirp/drivers/ft60.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft60.py	Thu May 14 20:58:56 2020 +0200
@@ -403,7 +403,7 @@
             self._mmap = _download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
         self.check_checksums()
@@ -414,7 +414,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def process_mmap(self):
@@ -716,7 +716,7 @@
                     setattr(_settings, name, value)
 
                 LOG.debug("Setting %s: %s" % (name, value))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft70.py
--- a/chirp/drivers/ft70.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft70.py	Thu May 14 20:58:56 2020 +0200
@@ -1162,7 +1162,7 @@
                 except AttributeError as e:
                     LOG.error("Setting %s is not in the memory map: %s" %
                               (element.get_name(), e))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft7100.py
--- a/chirp/drivers/ft7100.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft7100.py	Thu May 14 20:58:56 2020 +0200
@@ -568,7 +568,7 @@
             self._mmap = _download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Downloaded in %.2f sec", (time.time() - start))
         self.process_mmap()
@@ -580,7 +580,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         LOG.info("Uploaded in %.2f sec", (time.time() - start))
 
@@ -1091,7 +1091,7 @@
                     setattr(_overlay, name, value)
 
                 LOG.debug("Setting %s: %s", name, value)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft8100.py
--- a/chirp/drivers/ft8100.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft8100.py	Thu May 14 20:58:56 2020 +0200
@@ -175,7 +175,7 @@
 
         if _mem.duplex == DUPLEX.index("split"):
             tx_freq = int(_mem.offset) * 1000
-            print self.VARIANT, number, tx_freq, mem.freq
+            print(str(self.VARIANT) + " " + str(number) + " " + str(tx_freq) + " " + str(mem.freq))
             mem.offset = tx_freq - mem.freq
         else:
             mem.offset = int(_mem.offset) * 1000
@@ -189,7 +189,7 @@
         if not self._memobj.enables[byte] & bit and number != 1:
             mem.empty = True
 
-        print 'R', self.VARIANT, number, _mem.baud9600
+        print('R ' + str(self.VARIANT) + " " + str(number) + " " + str(_mem.baud9600))
 
         return mem
 
@@ -270,7 +270,7 @@
 def _clone_out(radio):
     try:
         return __clone_out(radio)
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with the radio: %s" % e)
 
 
@@ -291,7 +291,7 @@
     pos = 0
     for block in radio._block_lengths:
         if os.getenv("CHIRP_DEBUG"):
-            print "\nSending %i-%i" % (pos, pos + block)
+            print("\nSending %i-%i" % (pos, pos + block))
         out = radio.get_mmap()[pos:pos + block]
 
         # need to chew byte-by-byte here or else we lose the ACK...not sure why
@@ -309,6 +309,6 @@
 
         pos += block
 
-    print "Clone completed in %i seconds" % (time.time() - start)
+    print("Clone completed in %i seconds" % (time.time() - start))
 
     return True
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ft90.py
--- a/chirp/drivers/ft90.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ft90.py	Thu May 14 20:58:56 2020 +0200
@@ -332,7 +332,7 @@
             self._mmap = self._clone_in()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             trace = traceback.format_exc()
             raise errors.RadioError(
                     "Failed to communicate with radio: %s" % trace)
@@ -343,7 +343,7 @@
             self._clone_out()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             trace = traceback.format_exc()
             raise errors.RadioError(
                     "Failed to communicate with radio: %s" % trace)
@@ -670,6 +670,6 @@
                     newval = self._dtmf2bbcd(newval)
                 LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
                 setattr(_settings, setting, newval)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ftm350.py
--- a/chirp/drivers/ftm350.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ftm350.py	Thu May 14 20:58:56 2020 +0200
@@ -278,7 +278,7 @@
             self._mmap = _clone_in(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to download from radio (%s)" % e)
         self.process_mmap()
 
@@ -287,7 +287,7 @@
             _clone_out(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to upload to radio (%s)" % e)
 
     def process_mmap(self):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kguv8d.py
--- a/chirp/drivers/kguv8d.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kguv8d.py	Thu May 14 20:58:56 2020 +0200
@@ -376,7 +376,7 @@
             self._mmap = self._download()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -393,7 +393,7 @@
             return self._do_download(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             LOG.exception('Unknown error during download process')
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
@@ -426,7 +426,7 @@
             self._do_upload(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         return
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kguv8dplus.py
--- a/chirp/drivers/kguv8dplus.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kguv8dplus.py	Thu May 14 20:58:56 2020 +0200
@@ -418,7 +418,7 @@
             self._mmap = self._download()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -435,7 +435,7 @@
             return self._do_download(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             LOG.exception('Unknown error during download process')
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
@@ -467,7 +467,7 @@
             self._do_upload(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         return
 
@@ -1103,7 +1103,7 @@
                             setattr(obj, setting, int(element.value)/10)
                         else:
                             setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kguv8e.py
--- a/chirp/drivers/kguv8e.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kguv8e.py	Thu May 14 20:58:56 2020 +0200
@@ -337,7 +337,7 @@
 
         try:
             self.pipe.write(_header)
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def _read_record(self):
@@ -423,7 +423,7 @@
             self._mmap = self._download()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -440,7 +440,7 @@
             return self._do_download(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             LOG.exception('Unknown error during download process')
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
@@ -472,7 +472,7 @@
             self._do_upload(0, 32768, 64)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         return
 
@@ -1138,7 +1138,7 @@
                             setattr(obj, setting, int(element.value)/10)
                         else:
                             setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kguv9dplus.py
--- a/chirp/drivers/kguv9dplus.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kguv9dplus.py	Thu May 14 20:58:56 2020 +0200
@@ -877,7 +877,7 @@
             self._write_record(CMD_HANGUP)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             LOG.exception('Unknown error during download process')
             raise errors.RadioError(
                 "Failed to communicate with radio: %s" % e)
@@ -894,7 +894,7 @@
             self._write_record(CMD_HANGUP)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError(
                 "Failed to communicate with radio: %s" % e)
         return
@@ -1887,7 +1887,7 @@
                             setattr(obj, setting, int(element.value)/10)
                         else:
                             setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug("set_settings: Exception with %s" %
                               element.get_name())
                     raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kyd.py
--- a/chirp/drivers/kyd.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kyd.py	Thu May 14 20:58:56 2020 +0200
@@ -500,7 +500,7 @@
 
                     LOG.debug("Setting %s = %s" % (setting, element.value))
                     setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/kyd_IP620.py
--- a/chirp/drivers/kyd_IP620.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/kyd_IP620.py	Thu May 14 20:58:56 2020 +0200
@@ -181,7 +181,7 @@
             self.pipe.write("\x06")
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Radio refused to exit programming mode: %s" % e)
 
     def _ip620_enter_programming_mode(self):
@@ -192,7 +192,7 @@
             _ack = self.pipe.read(1)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Error communicating with radio: %s" % e)
         if not _ack:
             raise errors.RadioError("No response from radio")
@@ -203,17 +203,17 @@
             _ident = self.pipe.read(8)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Error communicating with radio: %s" % e)
         if not _ident.startswith("\x06\x4B\x47\x36\x37\x01\x56\xF8"):
-            print util.hexprint(_ident)
+            print(util.hexprint(_ident))
             raise errors.RadioError("Radio returned unknown identification string")
         try:
             self.pipe.write(CMD_ACK)
             _ack = self.pipe.read(1)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Error communicating with radio: %s" % e)
         if _ack != CMD_ACK:
             raise errors.RadioError("Radio refused to enter programming mode")
@@ -316,7 +316,7 @@
             self._mmap = self._do_download()
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -597,7 +597,7 @@
                 setattr(self._memobj.settings_misc,
                         element.get_name(),
                         element.value)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -624,6 +624,6 @@
                     setattr(_settings_misc, setting, newval)
                 else:
                     setattr(_settings, setting, newval)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/leixen.py
--- a/chirp/drivers/leixen.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/leixen.py	Thu May 14 20:58:56 2020 +0200
@@ -261,7 +261,7 @@
     #            util.hexprint(frame).replace("\n", "\n          ")))
     try:
         radio.pipe.write(frame)
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 
@@ -427,7 +427,7 @@
     def sync_in(self):
         try:
             self._mmap = do_download(self)
-        except Exception, e:
+        except Exception as e:
             finish(self)
             raise errors.RadioError("Failed to download from radio: %s" % e)
         self.process_mmap()
@@ -442,7 +442,7 @@
         except errors.RadioError:
             finish(self)
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to upload to radio: %s" % e)
 
     def get_raw_memory(self, number):
@@ -941,7 +941,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/lt725uv.py
--- a/chirp/drivers/lt725uv.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/lt725uv.py	Thu May 14 20:58:56 2020 +0200
@@ -1393,7 +1393,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/puxing.py
--- a/chirp/drivers/puxing.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/puxing.py	Thu May 14 20:58:56 2020 +0200
@@ -47,7 +47,7 @@
     for _i in range(0, 10):
         try:
             return _puxing_prep(radio)
-        except Exception, e:
+        except Exception as e:
             time.sleep(1)
 
     raise e
@@ -60,7 +60,7 @@
         return do_download(radio, 0x0000, 0x0C60, 0x0008)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 
@@ -71,7 +71,7 @@
         return do_upload(radio, 0x0000, 0x0C40, 0x0008)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 POWER_LEVELS = [chirp_common.PowerLevel("High", watts=5.00),
@@ -372,7 +372,7 @@
         return do_download(radio, 0x0000, 0x0FE0, 0x0010)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 
@@ -383,7 +383,7 @@
         return do_upload(radio, 0x0000, 0x0FE0, 0x0010)
     except errors.RadioError:
         raise
-    except Exception, e:
+    except Exception as e:
         raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
 PUXING_2R_MEM_FORMAT = """
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/radioddity_r2.py
--- a/chirp/drivers/radioddity_r2.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/radioddity_r2.py	Thu May 14 20:58:56 2020 +0200
@@ -611,7 +611,7 @@
 
                     LOG.debug("Setting %s = %s" % (setting, element.value))
                     setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/radtel_t18.py
--- a/chirp/drivers/radtel_t18.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/radtel_t18.py	Thu May 14 20:58:56 2020 +0200
@@ -478,7 +478,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/retevis_rt1.py
--- a/chirp/drivers/retevis_rt1.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/retevis_rt1.py	Thu May 14 20:58:56 2020 +0200
@@ -726,7 +726,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/retevis_rt21.py
--- a/chirp/drivers/retevis_rt21.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/retevis_rt21.py	Thu May 14 20:58:56 2020 +0200
@@ -561,7 +561,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
                     
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/retevis_rt22.py
--- a/chirp/drivers/retevis_rt22.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/retevis_rt22.py	Thu May 14 20:58:56 2020 +0200
@@ -605,7 +605,7 @@
 
                     LOG.debug("Setting %s = %s" % (setting, element.value))
                     setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/retevis_rt23.py
--- a/chirp/drivers/retevis_rt23.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/retevis_rt23.py	Thu May 14 20:58:56 2020 +0200
@@ -846,7 +846,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/retevis_rt26.py
--- a/chirp/drivers/retevis_rt26.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/retevis_rt26.py	Thu May 14 20:58:56 2020 +0200
@@ -897,7 +897,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/rfinder.py
--- a/chirp/drivers/rfinder.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/rfinder.py	Thu May 14 20:58:56 2020 +0200
@@ -240,7 +240,7 @@
                 dist = distance(self.__lat, self.__lon, lat, lon)
                 bear = fuzzy_to(self.__lat, self.__lon, lat, lon)
                 mem.comment = "(%imi %s) %s" % (dist, bear, mem.comment)
-            except Exception, e:
+            except Exception as e:
                 LOG.error("Failed to calculate distance: %s" % e)
 
         return mem
@@ -258,7 +258,7 @@
                 mem.number = number
                 number += 1
                 self.__memories.append(mem)
-            except Exception, e:
+            except Exception as e:
                 import traceback
                 LOG.error(traceback.format_exc())
                 LOG.error("Error in received data, cannot continue")
@@ -287,7 +287,7 @@
 
         self._rfp = None
 
-    def set_params(self, (lat, lon), miles, email, password):
+    def set_params(self, lat, lon, miles, email, password):
         """Sets the parameters to use for the query"""
         self._lat = lat
         self._lon = lon
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/rh5r_v2.py
--- a/chirp/drivers/rh5r_v2.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/rh5r_v2.py	Thu May 14 20:58:56 2020 +0200
@@ -167,7 +167,7 @@
                 filedata[0x840:0x848] == cls._FILEID)
 
     def process_mmap(self):
-        print MEM_FORMAT
+        print(MEM_FORMAT)
         self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)
 
     def get_raw_memory(self, number):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/tdxone_tdq8a.py
--- a/chirp/drivers/tdxone_tdq8a.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/tdxone_tdq8a.py	Thu May 14 20:58:56 2020 +0200
@@ -301,8 +301,8 @@
         try:
             data = _do_ident(radio, magic)
             return data
-        except errors.RadioError, e:
-            print e
+        except errors.RadioError as e:
+            print(e)
             error = e
             time.sleep(2)
     if error:
@@ -426,7 +426,7 @@
 
     if len(data) == 0x2008:
         rid = data[0x2000:0x2008]
-        print rid
+        print(rid)
         return rid.startswith(cls.MODEL)
     else:
         return False
@@ -1117,7 +1117,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
@@ -1131,7 +1131,7 @@
                     value = int(val.get_value() * 10)
                 LOG.debug("Setting fm_presets = %s" % (value))
                 self._memobj.fm_presets = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/th7800.py
--- a/chirp/drivers/th7800.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/th7800.py	Thu May 14 20:58:56 2020 +0200
@@ -536,7 +536,7 @@
 
                 LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
                 setattr(_settings, setting, newval)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -726,7 +726,7 @@
     def sync_in(self):
         try:
             self._mmap = _download(self)
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError(
                     "Failed to communicate with the radio: %s" % e)
         self.process_mmap()
@@ -734,6 +734,6 @@
     def sync_out(self):
         try:
             _upload(self)
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError(
                     "Failed to communicate with the radio: %s" % e)
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/th9000.py
--- a/chirp/drivers/th9000.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/th9000.py	Thu May 14 20:58:56 2020 +0200
@@ -352,7 +352,7 @@
     try:
         radio.pipe.write(data)
         radio.pipe.read(len(data))
-    except Exception, e:
+    except Exception as e:
         LOG.error("Error writing to radio: %s" % e)
         raise errors.RadioError("Unable to write to radio")
 
@@ -366,7 +366,7 @@
 def _read(radio, length):
     try:
         data = radio.pipe.read(length)
-    except Exception, e:
+    except Exception as e:
         LOG.error( "Error reading from radio: %s" % e)
         raise errors.RadioError("Unable to read from radio")
 
@@ -793,7 +793,7 @@
                     else:
                         LOG.debug( "Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug( element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/th9800.py
--- a/chirp/drivers/th9800.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/th9800.py	Thu May 14 20:58:56 2020 +0200
@@ -598,7 +598,7 @@
 
                 LOG.debug("Setting %s(%s) <= %s" % (setting, oldval, newval))
                 setattr(_settings, setting, newval)
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -785,7 +785,7 @@
     def sync_in(self):
         try:
             self._mmap = _download(self)
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError(
                     "Failed to communicate with the radio: %s" % e)
         self.process_mmap()
@@ -793,6 +793,6 @@
     def sync_out(self):
         try:
             _upload(self)
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError(
                     "Failed to communicate with the radio: %s" % e)
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/th_uv8000.py
--- a/chirp/drivers/th_uv8000.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/th_uv8000.py	Thu May 14 20:58:56 2020 +0200
@@ -1486,6 +1486,6 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/thd72.py
--- a/chirp/drivers/thd72.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/thd72.py	Thu May 14 20:58:56 2020 +0200
@@ -581,7 +581,7 @@
                 except AttributeError as e:
                     LOG.error("Setting %s is not in the memory map: %s" %
                               (element.get_name(), e))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -738,9 +738,9 @@
         return r
 
     def usage():
-        print "Usage: %s <-i input.img>|<-o output.img> -p port " \
+        print("Usage: %s <-i input.img>|<-o output.img> -p port " \
             "[[-f first-addr] [-l last-addr] | [-b list,of,blocks]]" % \
-            sys.argv[0]
+            sys.argv[0])
         sys.exit(1)
 
     opts, args = getopt.getopt(sys.argv[1:], "i:o:p:f:l:b:")
@@ -793,4 +793,4 @@
     else:
         r._mmap = file(fname, "rb").read(r._memsize)
         r.upload(blocks)
-    print "\nDone"
+    print("\nDone")
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/thuv1f.py
--- a/chirp/drivers/thuv1f.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/thuv1f.py	Thu May 14 20:58:56 2020 +0200
@@ -214,7 +214,7 @@
             self._mmap = uvf1_download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
         self.process_mmap()
 
@@ -223,7 +223,7 @@
             uvf1_upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     @classmethod
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/tk760g.py
--- a/chirp/drivers/tk760g.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/tk760g.py	Thu May 14 20:58:56 2020 +0200
@@ -907,7 +907,7 @@
             do_upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def process_mmap(self):
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ts2000.py
--- a/chirp/drivers/ts2000.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ts2000.py	Thu May 14 20:58:56 2020 +0200
@@ -217,7 +217,7 @@
             duplex = 0
             offset = 0
         else:
-            print "Bug: unsupported duplex `%s'" % mem.duplex
+            print("Bug: unsupported duplex `%s'" % mem.duplex)
         if mem.mode in ["AM", "FM"]:
             step = TS2000_FM_STEPS.index(mem.tuning_step)
         else:
@@ -259,7 +259,7 @@
         elif mem.duplex == "split":
             duplex = 0
         else:
-            print "Bug: unsupported duplex `%s'" % mem.duplex
+            print("Bug: unsupported duplex `%s'" % mem.duplex)
         if mem.mode in ["AM", "FM"]:
             step = TS2000_FM_STEPS.index(mem.tuning_step)
         else:
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ts480.py
--- a/chirp/drivers/ts480.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ts480.py	Thu May 14 20:58:56 2020 +0200
@@ -1138,7 +1138,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
         return
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/ts590.py
--- a/chirp/drivers/ts590.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/ts590.py	Thu May 14 20:58:56 2020 +0200
@@ -1644,7 +1644,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/vgc.py
--- a/chirp/drivers/vgc.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/vgc.py	Thu May 14 20:58:56 2020 +0200
@@ -1410,7 +1410,7 @@
                     elif element.value.get_mutable():
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/vx6.py
--- a/chirp/drivers/vx6.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/vx6.py	Thu May 14 20:58:56 2020 +0200
@@ -871,5 +871,5 @@
                 elif setting == "password":
                     newval = self._encode_chars(newval, 4)
                 setattr(_settings, setting, newval)
-            except Exception, e:
+            except Exception as e:
                 raise
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/vxa700.py
--- a/chirp/drivers/vxa700.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/vxa700.py	Thu May 14 20:58:56 2020 +0200
@@ -177,7 +177,7 @@
             self._mmap = _download(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate " +
                                     "with the radio: %s" % e)
         self.process_mmap()
@@ -192,7 +192,7 @@
             _upload(self)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate " +
                                     "with the radio: %s" % e)
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/drivers/wouxun.py
--- a/chirp/drivers/wouxun.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/drivers/wouxun.py	Thu May 14 20:58:56 2020 +0200
@@ -274,7 +274,7 @@
             return do_download(self, 0x0000, 0x2000, 0x0040)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def _upload(self):
@@ -285,7 +285,7 @@
             return do_upload(self, 0x0000, 0x2000, 0x0010)
         except errors.RadioError:
             raise
-        except Exception, e:
+        except Exception as e:
             raise errors.RadioError("Failed to communicate with radio: %s" % e)
 
     def sync_in(self):
@@ -658,7 +658,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
@@ -680,7 +680,7 @@
                 else:
                     setting = self._memobj.fm_presets_1
                 setting[index] = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -690,7 +690,7 @@
                 setattr(self._memobj.freq_ranges,
                         element.get_name(),
                         encode_freq(int(element.value)))
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
@@ -1397,7 +1397,7 @@
                     else:
                         LOG.debug("Setting %s = %s" % (setting, element.value))
                         setattr(obj, setting, element.value)
-                except Exception, e:
+                except Exception as e:
                     LOG.debug(element.get_name())
                     raise
 
@@ -1419,7 +1419,7 @@
                 else:
                     setting = self._memobj.fm_presets_1
                 setting[index] = value
-            except Exception, e:
+            except Exception as e:
                 LOG.debug(element.get_name())
                 raise
 
diff -r 68534f20c141 -r 82c1e35f0f2f chirp/ui/mainapp.py
--- a/chirp/ui/mainapp.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/chirp/ui/mainapp.py	Thu May 14 20:58:56 2020 +0200
@@ -1137,7 +1137,7 @@
 
         query = "http://chirp.danplanet.com/query/rb/1.0/app_direct" \
                 "?loc=%s&band=%s&dist=%s" % (loc, band, dist)
-        print query
+        print(query)
 
         # Do this in case the import process is going to take a while
         # to make sure we process events leading up to this
@@ -1328,7 +1328,7 @@
         else:
             from chirp.drivers import rfinder
             radio = rfinder.RFinderRadio(None)
-            radio.set_params((lat, lon), miles, email, passwd)
+            radio.set_params(lat, lon, miles, email, passwd)
             self.do_open_live(radio, read_only=True)
 
         self.window.set_cursor(None)
diff -r 68534f20c141 -r 82c1e35f0f2f locale/check_parameters.py
--- a/locale/check_parameters.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/locale/check_parameters.py	Thu May 14 20:58:56 2020 +0200
@@ -10,7 +10,7 @@
 formatter = Formatter()
 
 for name, po in pos.iteritems():
-    print "Testing", name
+    print("Testing " + str(name))
     for entry in po:
         if len(entry.msgstr) > 0:
             try:
@@ -21,11 +21,11 @@
                         for literal_text, field_name, format_spec, conversion
                         in formatter.parse(entry.msgstr)]
             except Exception as e:
-                print "Got exception!", e, "for entry", entry.msgid
+                print("Got exception! " + str(e) + " for entry " + str(entry.msgid))
             else:
                 if tids is not None:
                     missing = [name for name in tids
                                if name is not None and name not in ids]
                     if len(missing) > 0:
-                        print "Missing parameters", missing, \
-                              "in translation of", entry.msgid
+                        print("Missing parameters " + str(missing) + \
+                              " in translation of " + str(entry.msgid))
diff -r 68534f20c141 -r 82c1e35f0f2f setup.py
--- a/setup.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/setup.py	Thu May 14 20:58:56 2020 +0200
@@ -134,7 +134,6 @@
         data_files=[('share/applications', desktop_files),
                     ('share/chirp/images', image_files),
                     ('share/chirp', xsd_files),
-                    ('share/doc/chirp', ['COPYING']),
                     ('share/pixmaps', ['share/chirp.png']),
                     ('share/man/man1', ["share/chirpw.1"]),
                     ('share/chirp/stock_configs', stock_configs),
diff -r 68534f20c141 -r 82c1e35f0f2f share/make_supported.py
--- a/share/make_supported.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/share/make_supported.py	Thu May 14 20:58:56 2020 +0200
@@ -58,7 +58,7 @@
             try:
                 value = ", ".join([str(x) for x in value
                                    if not str(x).startswith("?")])
-            except Exception, e:
+            except Exception as e:
                 raise
 
         if key == "memory_bounds":
diff -r 68534f20c141 -r 82c1e35f0f2f tools/bitdiff.py
--- a/tools/bitdiff.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/tools/bitdiff.py	Thu May 14 20:58:56 2020 +0200
@@ -11,9 +11,9 @@
 def printDiff(pos, byte1, byte2, args):
     bits1 = '{0:08b}'.format(byte1)
     bits2 = '{0:08b}'.format(byte2)
-    print "@%04Xh" % pos
-    print "1:%02Xh, %sb" % (byte1, bits1)
-    print "2:%02Xh, %sb" % (byte2, bits2)
+    print("@%04Xh" % pos)
+    print("1:%02Xh, %sb" % (byte1, bits1))
+    print("2:%02Xh, %sb" % (byte2, bits2))
     if args.csv:
         writeDiffCSV(pos, byte1, byte2, args)
 
@@ -53,7 +53,7 @@
             printDiff(pos, b1, b2, args)
 
     pos = f1.tell() - args.offset
-    print "bytes read: %02d" % pos
+    print("bytes read: %02d" % pos)
     f1.close()
     f2.close()
 
@@ -82,7 +82,7 @@
             printDiff(pos, b1, b2, args)
 
     pos = length
-    print "bytes read: %02d" % pos
+    print("bytes read: %02d" % pos)
 
 
 def convertFileToBin(args):
@@ -147,9 +147,9 @@
 if args.offset:
     args.offset = int(args.offset, 16)
 
-print "f1:", args.file1, " f2:", args.file2
+print("f1: " + str(args.file1) + " f2:" + str(args.file2))
 if args.setting or args.value:
-    print "setting:", args.setting, "- value:", args.value
+    print("setting: " + str(args.setting) + " - value: " + str(args.value))
 
 while True:
     if (args.dat):
@@ -162,5 +162,5 @@
         compareFiles(args)
     if not args.watch:
         break
-    print "------"
+    print("------")
     time.sleep(delay)
diff -r 68534f20c141 -r 82c1e35f0f2f tools/cpep8.py
--- a/tools/cpep8.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/tools/cpep8.py	Thu May 14 20:58:56 2020 +0200
@@ -90,25 +90,25 @@
     return ignore
 
 if args.update:
-    print "Starting update of %d files" % len(manifest)
+    print("Starting update of %d files" % len(manifest))
     bad = []
     for f in manifest:
         checker = pep8.StyleGuide(quiet=True, ignore=get_exceptions(f))
         results = checker.check_files([f])
         if results.total_errors:
             bad.append(f)
-        print "%s: %s" % (results.total_errors and "FAIL" or "PASS", f)
+        print("%s: %s" % (results.total_errors and "FAIL" or "PASS", f))
 
     with file(blacklist_filename, "w") as fh:
-        print >>fh, """\
+        print( """\
 # cpep8.blacklist: The list of files that do not meet PEP8 standards.
 # DO NOT ADD NEW FILES!!  Instead, fix the code to be compliant.
-# Over time, this list should shrink and (eventually) be eliminated."""
-        print >>fh, "\n".join(sorted(bad))
+# Over time, this list should shrink and (eventually) be eliminated.""", file=fh)
+        print("\n".join(sorted(bad)), file=fh)
 
     if args.scan:
         with file(manifest_filename, "w") as fh:
-            print >>fh, "\n".join(sorted(manifest))
+            print("\n".join(sorted(manifest)), file=fh)
     sys.exit(0)
 
 if args.files:
@@ -126,7 +126,7 @@
 total_errors = 0
 for f in check_list:
     if args.verbose:
-        print "Checking %s" % f
+        print("Checking %s" % f)
 
     checker = pep8.Checker(f, quiet=args.stats, ignore=get_exceptions(f))
     results = checker.check_all()
diff -r 68534f20c141 -r 82c1e35f0f2f tools/img2thd72.py
--- a/tools/img2thd72.py	Thu Feb 13 16:35:52 2020 -0800
+++ b/tools/img2thd72.py	Thu May 14 20:58:56 2020 +0200
@@ -24,7 +24,7 @@
 
 
 def die(msg):
-    print msg
+    print(msg)
     sys.exit(1)
 
 
@@ -66,26 +66,26 @@
             line += dots[(ord(buf[byte]) >> (y % 8)) & 0x01]
         lines.append(line)
     for l in lines:
-        print l
+        print(l)
 
 
 def usage():
-    print "\nUsage: %s <-s|-g> [-i] [-d] " \
-          "<image-file> <thd72-nvram-file>" % sys.argv[0]
-    print "\nThis program will modify whatever nvram file provided or will"
-    print "create a new one if the file does not exist.  After using this to"
-    print "modify the image, you can use that file to upload all or part of"
-    print "it to your radio"
-    print "\nOption explanations:"
-    print "  -s     Save as the startup image"
-    print "  -g     Save as the GPS logger image"
-    print "  -i     Invert colors (black for white)"
-    print "         Depending on the file format the bits may be inverted."
-    print "         If your bitmap file turns out to be inverted, use -i."
-    print "  -d     Display the bitmap as dots (for confirmation)"
-    print "         Each black pixel is '*' and each white pixel is ' '"
-    print "         This will print up to 120 dots wide, so beware your"
-    print "         terminal size."
+    print("\nUsage: %s <-s|-g> [-i] [-d] " \
+          "<image-file> <thd72-nvram-file>" % sys.argv[0])
+    print("\nThis program will modify whatever nvram file provided or will")
+    print("create a new one if the file does not exist.  After using this to")
+    print("modify the image, you can use that file to upload all or part of")
+    print("it to your radio")
+    print("\nOption explanations:")
+    print("  -s     Save as the startup image")
+    print("  -g     Save as the GPS logger image")
+    print("  -i     Invert colors (black for white)")
+    print("         Depending on the file format the bits may be inverted.")
+    print("         If your bitmap file turns out to be inverted, use -i.")
+    print("  -d     Display the bitmap as dots (for confirmation)")
+    print("         Each black pixel is '*' and each white pixel is ' '")
+    print("         This will print up to 120 dots wide, so beware your")
+    print("         terminal size.")
     sys.exit(1)
 
 if __name__ == "__main__":
@@ -124,4 +124,4 @@
     blocks.append(imgpos/256)
     blocks.append(1+imgpos/256)
     blocks.append(2+imgpos/256)
-    print "Modified block list:", blocks
+    print("Modified block list: " + str(blocks))
