summaryrefslogtreecommitdiff
path: root/scripts/make_errorcodes.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-09-05 20:09:39 +0100
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2020-09-05 20:26:19 +0100
commit58c6a07e43b959b85ca4966b9f877801d502d51d (patch)
treef20c1822af90ce7d4ad00c238347dfc73afc48f4 /scripts/make_errorcodes.py
parent195b2549371ce4a2e8f1f9c94f06e921c1cda387 (diff)
downloadpsycopg2-58c6a07e43b959b85ca4966b9f877801d502d51d.tar.gz
Errors fetch scripts ported to Python 3
Diffstat (limited to 'scripts/make_errorcodes.py')
-rwxr-xr-xscripts/make_errorcodes.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/make_errorcodes.py b/scripts/make_errorcodes.py
index 1370ec8..26269c7 100755
--- a/scripts/make_errorcodes.py
+++ b/scripts/make_errorcodes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
"""Generate the errorcodes module starting from PostgreSQL documentation.
The script can be run at a new PostgreSQL release to refresh the module.
@@ -20,7 +20,7 @@ from __future__ import print_function
import re
import sys
-import urllib2
+from urllib.request import urlopen
from collections import defaultdict
@@ -57,10 +57,10 @@ def parse_errors_txt(url):
classes = {}
errors = defaultdict(dict)
- page = urllib2.urlopen(url)
+ page = urlopen(url)
for line in page:
# Strip comments and skip blanks
- line = line.split('#')[0].strip()
+ line = line.decode("ascii").split('#')[0].strip()
if not line:
continue