Skip to content

Commit e2f76f7

Browse files
committed
Fix revert path after load mechanisms
1 parent 0efb8f5 commit e2f76f7

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

netpyne_ui/mod_utils.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,22 @@ def is_loaded_mechanisms():
2828

2929
def loadModMechFiles(compileMod, modFolder):
3030
# Create Symbolic link
31-
if compileMod:
32-
modPath = os.path.join(str(modFolder), "x86_64")
33-
34-
if os.path.exists(modPath):
35-
shutil.rmtree(modPath)
3631

37-
os.chdir(modFolder)
38-
subprocess.call(["nrnivmodl"])
39-
os.chdir('..')
40-
41-
try:
42-
neuron.load_mechanisms(str(modFolder))
43-
except:
44-
raise
32+
if compileMod:
33+
try:
34+
owd = os.getcwd()
35+
modPath = os.path.join(str(modFolder), "x86_64")
36+
37+
if os.path.exists(modPath):
38+
shutil.rmtree(modPath)
39+
40+
os.chdir(modFolder)
41+
subprocess.call(["nrnivmodl"])
42+
os.chdir('..')
43+
44+
try:
45+
neuron.load_mechanisms(str(modFolder))
46+
except:
47+
raise
48+
finally:
49+
os.chdir(owd)

0 commit comments

Comments
 (0)