Skip to content

Commit

Permalink
Replacing + with os.path.join() in data.py for Windows compatability.…
Browse files Browse the repository at this point in the history
… Issue #139
  • Loading branch information
jk1066 committed Oct 7, 2024
1 parent 4e14ec8 commit d824579
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions src/tesp_support/tesp_support/api/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,31 +20,33 @@
components = ["",
"data",
"examples",
"examples/analysis",
"examples/capabilities",
path.join("examples", "analysis"),
path.join("examples", "capabilities"),
"models",
"scripts",
"src",
"src/tesp_support/test"]
path.join("src", "tesp_support", "test")]

if 'TESPDIR' in environ:
tesp_path = environ['TESPDIR']
else:
tesp_path = path.expanduser('~') + '/grid/tesp'
tesp_path = path.join(path.expanduser('~'), "grid", "tesp")

# uncomment for debug
# tesp_path = path.expanduser('~') + '/tesp'
# chdir(tesp_path)
# tesp_path = path.expanduser('~') + '/tesp/tesp'
#print(tesp_path)
#tesp_path = path.join(path.expanduser('~'), '/tesp')
#chdir(tesp_path)
#tesp_path = path.join(path.expanduser('~'), '/tesp/tesp')

if path.isdir(tesp_path):
for _dir in components:
tmp = tesp_path + '/' + _dir
tmp = path.join(tesp_path, _dir)
if path.isdir(tmp):
# print(tmp + " directory has been installed for TESP")
#print(tmp + " directory has been installed for TESP")
chdir(tmp)
pass
else:
# print(tmp + " directory has NOT been installed for TESP")
#print(tmp + " directory has NOT been installed for TESP")
pass
else:
# New instance
Expand All @@ -64,14 +66,14 @@


tesp_share = path.expandvars(tesp_path + '/data/')
comm_path = tesp_share + 'comm/'
energyplus_path = tesp_share + 'energyplus/'
feeders_path = tesp_share + 'feeders/'
scheduled_path = tesp_share + 'schedules/'
weather_path = tesp_share + 'weather/'
comm_path = path.join(tesp_share, "comm")
energyplus_path = path.join(tesp_share, "energyplus")
feeders_path = path.join(tesp_share, "feeders")
scheduled_path = path.join(tesp_share, "schedules")
weather_path = path.join(tesp_share, "weather")

tesp_model = path.expandvars(tesp_path + '/models/')
pypower_path = tesp_model + 'pypower/'
pypower_path = path.join(tesp_model, "pypower")

tesp_test = path.expandvars(tesp_path + '/src/tesp_support/test/')

Expand Down Expand Up @@ -146,7 +148,7 @@ def tesp_component():
print("Bad choice, choose 1 through 9")
return

component = tesp_path + '/' + components[choice]
component = path.join(tesp_path, components[choice])
if path.isdir(component):
print("It seems we have a copy of " + component)
return
Expand Down

0 comments on commit d824579

Please sign in to comment.