diff --git a/Tools/autotest/param_metadata/htmlemit.py b/Tools/autotest/param_metadata/htmlemit.py
index 66639dcbc7..b0a76f858f 100644
--- a/Tools/autotest/param_metadata/htmlemit.py
+++ b/Tools/autotest/param_metadata/htmlemit.py
@@ -5,7 +5,10 @@ Emit docs in a form acceptable to the old Ardupilot wordpress docs site
from param import known_param_fields, known_units
from emit import Emit
-import html
+try:
+ from cgi import escape as cescape
+except Exception:
+ from html import escape as cescape
class HtmlEmit(Emit):
@@ -59,7 +62,7 @@ DO NOT EDIT
t += '\n\n
%s
' % tag
if d.get('User', None) == 'Advanced':
t += 'Note: This parameter is for advanced users
'
- t += "\n\n%s
\n" % html.escape(param.Description)
+ t += "\n\n%s
\n" % cescape(param.Description)
t += "\n"
for field in param.__dict__.keys():
@@ -77,8 +80,8 @@ DO NOT EDIT
abreviated_units = param.__dict__[field]
if abreviated_units != '':
units = known_units[abreviated_units] # use the known_units dictionary to convert the abreviated unit into a full textual one
- t += "- %s: %s
\n" % (field, html.escape(units))
+ t += "- %s: %s
\n" % (field, cescape(units))
else:
- t += "- %s: %s
\n" % (field, html.escape(param.__dict__[field]))
+ t += "- %s: %s
\n" % (field, cescape(param.__dict__[field]))
t += "
\n"
self.t += t
diff --git a/Tools/autotest/param_metadata/rstemit.py b/Tools/autotest/param_metadata/rstemit.py
index 1b0bc7e085..d2c6a275e0 100644
--- a/Tools/autotest/param_metadata/rstemit.py
+++ b/Tools/autotest/param_metadata/rstemit.py
@@ -3,7 +3,10 @@ from __future__ import print_function
import re
from param import known_param_fields, known_units
from emit import Emit
-import html
+try:
+ from cgi import escape as cescape
+except Exception:
+ from html import escape as cescape
# Emit docs in a RST format
@@ -256,9 +259,9 @@ Complete Parameter List
# convert the abreviated unit into a full
# textual one:
units = known_units[abreviated_units]
- row.append(html.escape(units))
+ row.append(cescape(units))
else:
- row.append(html.escape(param.__dict__[field]))
+ row.append(cescape(param.__dict__[field]))
if len(row):
ret += "\n\n" + self.tablify([row], headings=headings) + "\n\n"
self.t += ret + "\n"