Skip to content

Commit e7d8acc

Browse files
author
Nathan Lee
committed
Small compatability patch for config
1 parent d52c8a3 commit e7d8acc

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

pyrunner/core/config.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,15 @@ def source_config_file(self, config_file):
252252
Raises:
253253
FileNotFoundError: Could not find specified file or is not a file.
254254
"""
255-
print('Sourcing File: {}'.format(config_file))
256-
if not config_file or not os.path.isfile(config_file):
257-
raise FileNotFoundError('Configuration file {} does not exist.'.format(config_file))
255+
# For compatability with older Python3 versions
256+
str_path = str(config_file)
257+
258+
print('Sourcing File: {}'.format(str_path))
259+
if not str_path or not os.path.isfile(str_path):
260+
raise FileNotFoundError('Configuration file {} does not exist.'.format(str_path))
258261

259262
# Source config file and print out all environment vars
260-
command = ['bash', '-c', 'source {} && env | grep ^APP_'.format(config_file)]
263+
command = ['bash', '-c', 'source {} && env | grep ^APP_'.format(str_path)]
261264
proc = Popen(command, stdout = PIPE)
262265

263266
# Set environment vars returned by process

0 commit comments

Comments
 (0)