-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #401 from dlubal-software/bugfix/psutil
Bugfix/psutil
- Loading branch information
Showing
10 changed files
with
72 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
def getPathToRunningRFEM(): | ||
''' | ||
Find the path to the directory where RFEM 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'] == 'RFEM6.exe': | ||
idx = p.info['exe'].find('bin') | ||
path = p.info['exe'][:idx] | ||
elif p.info['name'] == 'RFEM6Server.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 RSTAB.') | ||
if not path: | ||
raise ValueError('Is it possible that RFEM is not runnnning?') | ||
|
||
return path |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters