mirror of
https://github.com/balkian/bitter.git
synced 2024-12-22 00:18:12 +00:00
Fix py2 compatibility
This commit is contained in:
parent
27bc3557b2
commit
7c829ee102
@ -1 +1 @@
|
||||
0.7.6
|
||||
0.7.7
|
||||
|
@ -30,6 +30,12 @@ from bitter.models import Following, User, ExtractorEntry, make_session
|
||||
|
||||
from bitter import config
|
||||
|
||||
# Fix Python 2.x.
|
||||
try:
|
||||
UNICODE_EXISTS = bool(type(unicode))
|
||||
except NameError:
|
||||
unicode = lambda s: str(s)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@ -90,7 +96,7 @@ def read_config(conffile):
|
||||
elif 'BITTER_CONFIG' not in os.environ:
|
||||
raise Exception('No config file or BITTER_CONFIG env variable.')
|
||||
else:
|
||||
f = io.StringIO(os.environ.get('BITTER_CONFIG', "").strip().replace('\\n', '\n'))
|
||||
f = io.StringIO(unicode(os.environ.get('BITTER_CONFIG', "")).strip().replace('\\n', '\n'))
|
||||
return yaml.load(f) or {'credentials': []}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user