summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith@newrelic.com>2014-12-14 22:05:11 -0800
committerAmjith Ramanujam <amjith@newrelic.com>2014-12-14 22:05:11 -0800
commitb0bea4dc500493825128bf41b44cb9b973d1ce55 (patch)
tree2179f3d4483ec0187ae022a86f2db1cf045a5614
parent6a5e53b94980cf1a82c0ce25ba0d9f10a9a2395d (diff)
Python3 compatibility.
-rw-r--r--pgcli/config.py9
-rw-r--r--pgcli/packages/pgspecial.py15
2 files changed, 14 insertions, 10 deletions
diff --git a/pgcli/config.py b/pgcli/config.py
index 5677125d..e54a165b 100644
--- a/pgcli/config.py
+++ b/pgcli/config.py
@@ -1,11 +1,14 @@
from shutil import copyfile
from os.path import expanduser, exists
-from ConfigParser import SafeConfigParser
-#from prompt_toolkit.contrib.pdb import set_trace
+try:
+ from ConfigParser import SafeConfigParser as ConfigParser
+except ImportError:
+ from configparser import ConfigParser
+# from prompt_toolkit.contrib.pdb import set_trace
def load_config(filename):
filename = expanduser(filename)
- parser = SafeConfigParser()
+ parser = ConfigParser()
parser.read(filename)
return parser
diff --git a/pgcli/packages/pgspecial.py b/pgcli/packages/pgspecial.py
index 499573ba..96acff10 100644
--- a/pgcli/packages/pgspecial.py
+++ b/pgcli/packages/pgspecial.py
@@ -1,7 +1,8 @@
+from __future__ import print_function
import sys
import logging
from collections import namedtuple
-from tabulate import tabulate
+from .tabulate import tabulate
TableInfo = namedtuple("TableInfo", ['checks', 'relkind', 'hasindex',
'hasrules', 'hastriggers', 'hasoids', 'tablespace', 'reloptions', 'reloftype',
@@ -12,10 +13,10 @@ log = logging.getLogger(__name__)
class MockLogging(object):
def debug(self, string):
- print "***** Query ******"
- print string
- print "******************"
- print
+ print ("***** Query ******")
+ print (string)
+ print ("******************")
+ print ()
#log = MockLogging()
@@ -740,5 +741,5 @@ if __name__ == '__main__':
cur = con.cursor()
table = sys.argv[1]
for rows, headers, status in describe_table_details(cur, table, False):
- print tabulate(rows, headers, tablefmt='psql')
- print status
+ print(tabulate(rows, headers, tablefmt='psql'))
+ print(status)