diff --git a/vcli/main.py b/vcli/main.py index b5117b5..4251cf2 100755 --- a/vcli/main.py +++ b/vcli/main.py @@ -20,7 +20,16 @@ from collections import namedtuple from time import time -from urlparse import urlparse + +try: + from urlparse import urlparse +except ImportError: + from urllib.parse import urlparse + +try: + basestring +except NameError: + basestring = str from prompt_toolkit import CommandLineInterface, Application, AbortAction from prompt_toolkit.buffer import AcceptAction diff --git a/vcli/vcompleter.py b/vcli/vcompleter.py index 45218b2..a88c06d 100644 --- a/vcli/vcompleter.py +++ b/vcli/vcompleter.py @@ -72,6 +72,7 @@ def __init__(self, smart_completion=True, vspecial=None): self.all_completions = set(self.keywords + self.functions) def escape_name(self, name): + name = name.decode('utf-8') if type(name) == bytes else name if name and ((not self.name_pattern.match(name)) or (name.upper() in self.reserved_words) or (name.upper() in self.functions)): diff --git a/vcli/vexecute.py b/vcli/vexecute.py index 4af74cd..b6c09df 100644 --- a/vcli/vexecute.py +++ b/vcli/vexecute.py @@ -198,7 +198,7 @@ def search_path(self): _logger.debug('Search path query. sql: %r', self.search_path_query) cur.execute(self.search_path_query) names = cur.fetchone()[0] - return names.split(',') + return names.split(b',') def schemata(self): """Returns a list of schema names in the database"""