From 49d60f835c7c2519e8894213ce5f161a803dbcd7 Mon Sep 17 00:00:00 2001 From: Niles Rogoff Date: Sat, 11 Jun 2016 23:28:01 -0400 Subject: [PATCH] Python 2 compatable --- BTEdb.py | 5 ++++- setup.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/BTEdb.py b/BTEdb.py index 0efc082..8f79207 100644 --- a/BTEdb.py +++ b/BTEdb.py @@ -45,7 +45,10 @@ def OpenDatabase(self, filename, pretty = False): # Open database file self.pretty = pretty # Set "pretty" as an instance variable try: if type(filename) == str: # If we're being called on a string - self.fileObj = open(filename,"r+", os.O_NONBLOCK, encoding="utf8") # set fileobj to open + try: + self.fileObj = open(filename,"r+", os.O_NONBLOCK, encoding="utf8") # set fileobj to open + except TypeError: + self.fileObj = open(filename,"r+", os.O_NONBLOCK) # python2 compat else: # otherwise self.master = json.loads(filename.read()) # assume it's an object and try to read from it self.fileObj = filename diff --git a/setup.py b/setup.py index 31b6541..fc432c1 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #from distutils.core import setup from setuptools import setup setup(name='BTEdb', - version='7.0', + version='7.0.1', description="Python schemaless JSON/YAML database interface", author="Peter Rogoff", author_email="peter@rogoff.xyz",