diff --git a/RFEM/initModel.py b/RFEM/initModel.py index 7857cad6..9c113bbf 100644 --- a/RFEM/initModel.py +++ b/RFEM/initModel.py @@ -893,34 +893,34 @@ def GetAppSessionId(): # Client Application | Get Session ID return connectionGlobals.client.service.get_session_id() -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 +# 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 def GetListOfOpenedModels(): diff --git a/UnitTests/test_DesignOverview.py b/UnitTests/test_DesignOverview.py index 2f7242ae..04b86459 100644 --- a/UnitTests/test_DesignOverview.py +++ b/UnitTests/test_DesignOverview.py @@ -8,12 +8,13 @@ sys.path.append(PROJECT_ROOT) from RFEM.enums import AddOn -from RFEM.initModel import Model, SetAddonStatus, getPathToRunningRFEM +from RFEM.initModel import Model, SetAddonStatus from RFEM.connectionGlobals import url from RFEM.Results.designOverview import GetDesignOverview, GetPartialDesignOverview from RFEM.Reports.partsList import GetPartsListAllByMaterial, GetPartsListMemberRepresentativesByMaterial from RFEM.Reports.partsList import GetPartsListMemberSetsByMaterial, GetPartsListMembersByMaterial from RFEM.Reports.partsList import GetPartsListSolidsByMaterial, GetPartsListSurfacessByMaterial +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/test_Export.py b/UnitTests/test_Export.py index 30d62888..2d86cf4f 100644 --- a/UnitTests/test_Export.py +++ b/UnitTests/test_Export.py @@ -6,9 +6,9 @@ os.pardir) ) sys.path.append(PROJECT_ROOT) - +from tools import getPathToRunningRFEM from RFEM.enums import ObjectTypes -from RFEM.initModel import Model, closeModel, getPathToRunningRFEM +from RFEM.initModel import Model, closeModel from RFEM.ImportExport.exports import IFCExportSettings, ObjectLocation, ObjectLocations, ExportToIFC, GetTableExportConfigManager, SetTableExportConfigManager, ExportTo from RFEM.ImportExport.imports import getConversionTables, setConversionTables, getSAFSettings, setSAFSettings, importFrom sys.path.append('..') diff --git a/UnitTests/test_GetAllObjects.py b/UnitTests/test_GetAllObjects.py index 29f105f9..870d5f20 100644 --- a/UnitTests/test_GetAllObjects.py +++ b/UnitTests/test_GetAllObjects.py @@ -5,10 +5,11 @@ os.pardir) ) sys.path.append(PROJECT_ROOT) -from RFEM.initModel import Model, getPathToRunningRFEM +from RFEM.initModel import Model from RFEM.connectionGlobals import url from RFEM.Tools.GetObjectNumbersByType import GetAllObjects import pytest +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/test_GlobalParameters_Test.py b/UnitTests/test_GlobalParameters_Test.py index 806f3da6..51f41be3 100644 --- a/UnitTests/test_GlobalParameters_Test.py +++ b/UnitTests/test_GlobalParameters_Test.py @@ -12,9 +12,10 @@ import pytest from RFEM.enums import GlobalParameterUnitGroup, GlobalParameterDefinitionType, ObjectTypes from RFEM.globalParameter import GlobalParameter -from RFEM.initModel import Model, getPathToRunningRFEM +from RFEM.initModel import Model from RFEM.connectionGlobals import url import pytest +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/test_Reports.py b/UnitTests/test_Reports.py index 7f6c7e0b..5280a401 100644 --- a/UnitTests/test_Reports.py +++ b/UnitTests/test_Reports.py @@ -7,11 +7,12 @@ sys.path.append(PROJECT_ROOT) from RFEM.Reports.printoutReport import PrintoutReport from RFEM.Reports.html import ExportResultTablesToHtml -from RFEM.initModel import Model, closeModel, openFile, getPathToRunningRFEM +from RFEM.initModel import Model, closeModel, openFile from RFEM.connectionGlobals import url from shutil import rmtree import pytest import time +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/test_ResultTables.py b/UnitTests/test_ResultTables.py index 1305e3a2..db2449e8 100644 --- a/UnitTests/test_ResultTables.py +++ b/UnitTests/test_ResultTables.py @@ -8,10 +8,11 @@ os.pardir) ) sys.path.append(PROJECT_ROOT) -from RFEM.initModel import Model, getPathToRunningRFEM +from RFEM.initModel import Model from RFEM.connectionGlobals import url from RFEM.enums import CaseObjectType from RFEM.Results.resultTables import ResultTables +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/test_nodalReleaseType.py b/UnitTests/test_nodalReleaseType.py index 465698e3..0c1b3665 100644 --- a/UnitTests/test_nodalReleaseType.py +++ b/UnitTests/test_nodalReleaseType.py @@ -6,12 +6,13 @@ ) sys.path.append(PROJECT_ROOT) -from RFEM.initModel import Model, getPathToRunningRFEM +from RFEM.initModel import Model from RFEM.connectionGlobals import url from RFEM.enums import NodalReleaseTypeReleaseNonlinearity, NodalReleaseTypePartialActivityAround, NodalReleaseTypeLocalAxisSystemObjectType from RFEM.enums import NodalReleaseTypePartialActivityAlong, NodalReleaseTypeDiagram from RFEM.TypesForSpecialObjects.nodalReleaseType import NodalReleaseType import pytest +from tools import getPathToRunningRFEM if Model.clientModel is None: Model() diff --git a/UnitTests/tools.py b/UnitTests/tools.py new file mode 100644 index 00000000..48093a7b --- /dev/null +++ b/UnitTests/tools.py @@ -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 \ No newline at end of file diff --git a/setup.py b/setup.py index a1651452..e2f410a3 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='RFEM', - version='1.20.2', + version='1.20.3', description='Python Framework for RFEM6 Web Services', long_description=readme, long_description_content_type = "text/markdown", @@ -24,6 +24,6 @@ packages=find_packages(), package_dir={"RFEM":"RFEM"}, include_package_data=True, - install_requires=["requests", "six", "suds-py3", "xmltodict", "pytest", "psutil", "mock", "setuptools"], + install_requires=["requests", "six", "suds-py3", "xmltodict", "pytest", "mock", "setuptools"], zip_safe = False )