Skip to content

Commit

Permalink
Python 2 compatable
Browse files Browse the repository at this point in the history
  • Loading branch information
nilesr committed Jun 12, 2016
1 parent 595a667 commit 49d60f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion BTEdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down

0 comments on commit 49d60f8

Please sign in to comment.