Skip to content

Commit 3423429

Browse files
committed
Fixed crash in Py2 environment with no .env file
Tapis CLI is not intended to require a .env file, but logic for exploring likely paths where one might be found only caught the OSError raised by python-dotenv under Python3, not the IOError raised under Python2. This fix simply enumerates both Exceptions as acceptable means of signaling an .env file was not found at the designated path. Tested under Python2 and Python3 Closes #225
1 parent 11875f2 commit 3423429

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tapis_cli/settings/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ def find_config(filename='.env'):
1818
try:
1919
# Search from __file__ up to /
2020
env_file = find_dotenv(filename, raise_error_if_not_found=True)
21-
except OSError:
21+
except (IOError, OSError):
2222
# Search from current working directory
2323
try:
2424
env_file = find_dotenv(filename=filename,
2525
raise_error_if_not_found=True,
2626
usecwd=True)
27-
except OSError:
27+
except (IOError, OSError):
2828
# Fall back to $HOME
2929
pass
3030
return env_file

0 commit comments

Comments
 (0)