forked from dlubal-software/RSTAB_Python_Client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtools.py
More file actions
28 lines (25 loc) · 962 Bytes
/
Copy pathtools.py
File metadata and controls
28 lines (25 loc) · 962 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def getPathToRunningRSTAB():
'''
Find the path to the directory where RSTAB is currently running.
This is helpful when using server version, because it can't process relative paths.
'''
import psutil
rstab9 = False
rstab9Server = False
path = ''
for p in psutil.process_iter(['name', 'exe']):
if p.info['name'] == 'RSTAB9.exe':
idx = p.info['exe'].find('bin')
path = p.info['exe'][:idx]
elif p.info['name'] == 'RSTAB9Server.exe':
idx = p.info['exe'].find('bin')
path = p.info['exe'][:idx]
elif p.info['name'] == 'RSTAB9.exe':
rstab9 = True
elif p.info['name'] == 'RSTAB9Server.exe':
rstab9Server = True
if rstab9 or rstab9Server:
raise ValueError('Careful! You are running RFEM Python Client on RFEM.')
if not path:
raise ValueError('Is it possible that RSTAB is not runnnning?')
return path