Skip to content

Commit

Permalink
creating parent folder of credentials.toml if doesnt exist
Browse files Browse the repository at this point in the history
  • Loading branch information
acycliq committed Mar 30, 2024
1 parent 529d9b0 commit 8d49ee6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pciSeq/src/diagnostics/launch_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def make_credentials():
might pause the program flow)
"""
credentials = os.path.join(Path.home(), '.streamlit', 'credentials.toml')
Path(credentials).parent.mkdir(parents=True, exist_ok=True)
mode = 'rt' if os.path.exists(credentials) else 'w+'
with open(credentials, mode) as fp:
doc = tomlkit.load(fp)
Expand All @@ -44,4 +45,4 @@ def append_email(doc, fname):
if doc.get('general').get('email') is None:
doc.get('general').add("email", "")
with open(fname, 'w') as outfile:
tomlkit.dump(doc, outfile)
tomlkit.dump(doc, outfile)

0 comments on commit 8d49ee6

Please sign in to comment.