Skip to content

Commit

Permalink
Fix executable directory handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Oct 5, 2023
1 parent 2541051 commit 8db2181
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,21 @@
from datetime import date
import numpy as np
import pdb
import sys

current_file_path = sys.executable
basename = os.path.basename(current_file_path)
if basename == "python.exe" or basename == "python" or basename == "python3":
print("Running from source")
current_file_path = __file__


def main():
# Change pwd to the directory of this file
abspath = os.path.abspath(__file__)

abspath = os.path.abspath(current_file_path)
dname = os.path.dirname(abspath)
print(f"Changing working directory to {dname}")
os.chdir(dname)

# If config.yml does not exist, create it from the template
Expand Down

0 comments on commit 8db2181

Please sign in to comment.