Closed tjlca closed 8 months ago
I'm hesitant to do a full system path search for the technology model file, but I think it would be a relatively simple fix to search two locations within the repository to catch the case where the GUI is being used.
Can you clarify a couple things:
GUI_dev
branch up to date for me to branch off of and do some testing/resolve this issue?@tjlca Do you still need me to address this issue?
Rebecca, sorry for the delay in this development.
So in short its not resolved yet completely and it will be great if the solutions you recommended can be implemented. The issue has been resolved by changing the working directory to the technology directory of Tyche, every time the Tyche model is called from the GUI. You can find these change directory commands in the path change function inside run_tyche of the tyche gui directory.
Right now the GUI Dev branch is up to date.
@tjlca The logic below that Nicholas implemented (for IO.py) might be useful for the os.chdir
call in client.py to avoid specifying the entire path.
this_script_path = os.path.realpath(__file__)
this_script_dir = os.path.abspath(os.path.dirname(this_script_path))
for _tech, _meta in functions.iterrows():
# First check that the model exists as a .py file in the correct location
_model_py_path = os.path.join(this_script_dir,
os.pardir, # parent directory
"technology",
_meta['Model'] + '.py')
File IO.py
Lines 171
The path exists line assumes that the technology file is one folder up. Can this be made general so that system path is searched for the technology file? The issue cropped up when I was trying to run Tyche from the GUI functions. They are in a folder outside Tyche. So the current directory is different.