Skip to content

Commit 77e5e6c

Browse files
committed
Moved check for file_exists outside of blackmagic loop
1 parent 12870ca commit 77e5e6c

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

dotenv.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ def read_dotenv(dotenv=None):
1212
if dotenv is None:
1313
frame = sys._getframe()
1414
dotenv = os.path.join(os.path.dirname(frame.f_back.f_code.co_filename), '.env')
15-
if not os.path.exists(dotenv):
16-
warnings.warn("not reading %s - it doesn't exist." % dotenv)
17-
return
15+
if not os.path.exists(dotenv):
16+
warnings.warn("not reading %s - it doesn't exist." % dotenv)
17+
return
1818
for k, v in parse_dotenv(dotenv):
1919
os.environ.setdefault(k, v)
2020

21+
def write_dotenv(dotenv=None):
22+
23+
2124
def parse_dotenv(dotenv):
2225
for line in open(dotenv):
2326
line = line.strip()

0 commit comments

Comments
 (0)