summaryrefslogtreecommitdiff
path: root/examples/cursor.py
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-11-28 16:27:41 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-11-28 16:27:41 +0000
commit3e52b5445ba1bcf50dc4b0b4357fc9fcfdcc5741 (patch)
treebfdb7a261b96216d0c98958a882d2d7bb423de43 /examples/cursor.py
parente7529e4823a444b6d71a15bd5fb04e1662e9fc62 (diff)
parentf939f39580c46e1601e2f7c491e2afa9fdabbfbe (diff)
downloadpsycopg2-3e52b5445ba1bcf50dc4b0b4357fc9fcfdcc5741.tar.gz
Merge branch 'rm-eol'
Fix #626, close #628.
Diffstat (limited to 'examples/cursor.py')
-rw-r--r--examples/cursor.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/examples/cursor.py b/examples/cursor.py
index 2d56fd7..465967c 100644
--- a/examples/cursor.py
+++ b/examples/cursor.py
@@ -25,9 +25,9 @@ import psycopg2.extensions
if len(sys.argv) > 1:
DSN = sys.argv[1]
-print "Opening connection using dsn:", DSN
+print("Opening connection using dsn:", DSN)
conn = psycopg2.connect(DSN)
-print "Encoding for this connection is", conn.encoding
+print("Encoding for this connection is", conn.encoding)
class NoDataError(psycopg2.ProgrammingError):
@@ -52,12 +52,12 @@ class Cursor(psycopg2.extensions.cursor):
curs = conn.cursor(cursor_factory=Cursor)
curs.execute("SELECT 1 AS foo")
-print "Result of fetchone():", curs.fetchone()
+print("Result of fetchone():", curs.fetchone())
# now let's raise the exception
try:
curs.fetchone()
-except NoDataError, err:
- print "Exception caught:", err
+except NoDataError as err:
+ print("Exception caught:", err)
conn.rollback()