summaryrefslogtreecommitdiff
path: root/scripts/make_errorcodes.py
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2017-12-03 18:47:19 -0800
committerJon Dufresne <jon.dufresne@gmail.com>2017-12-10 10:51:07 -0800
commit9de46e416e5ac1be1c5ff170d1c1ada5b8d7278f (patch)
tree62291426bc36f26ed5ac65d597ed15a5654a4e22 /scripts/make_errorcodes.py
parentef64493b8913e4069c4422ad14da6de405c445f6 (diff)
downloadpsycopg2-9de46e416e5ac1be1c5ff170d1c1ada5b8d7278f.tar.gz
Use print() function instead of print statement throughout project
Forward compatible with newer Pythons.
Diffstat (limited to 'scripts/make_errorcodes.py')
-rwxr-xr-xscripts/make_errorcodes.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/make_errorcodes.py b/scripts/make_errorcodes.py
index 1769ba5..adc6ee8 100755
--- a/scripts/make_errorcodes.py
+++ b/scripts/make_errorcodes.py
@@ -15,6 +15,7 @@ The script can be run at a new PostgreSQL release to refresh the module.
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
+from __future__ import print_function
import re
import sys
@@ -26,7 +27,7 @@ from BeautifulSoup import BeautifulSoup as BS
def main():
if len(sys.argv) != 2:
- print >>sys.stderr, "usage: %s /path/to/errorcodes.py" % sys.argv[0]
+ print("usage: %s /path/to/errorcodes.py" % sys.argv[0], file=sys.stderr)
return 2
filename = sys.argv[1]
@@ -39,9 +40,9 @@ def main():
f = open(filename, "w")
for line in file_start:
- print >>f, line
+ print(line, file=f)
for line in generate_module_data(classes, errors):
- print >>f, line
+ print(line, file=f)
def read_base_file(filename):
@@ -141,7 +142,7 @@ def fetch_errors(versions):
errors = defaultdict(dict)
for version in versions:
- print >> sys.stderr, version
+ print(version, file=sys.stderr)
tver = tuple(map(int, version.split()[0].split('.')))
if tver < (9, 1):
c1, e1 = parse_errors_sgml(errors_sgml_url % version)