ansys / grantami-bomanalytics

Pythonic interface for Ansys Granta Compliance reporting API
http://bomanalytics.grantami.docs.pyansys.com/
MIT License
5 stars 0 forks source link

Error while querying result #217

Closed hsahire closed 2 years ago

hsahire commented 2 years ago

🔍 Before submitting the issue

🐞 Description of the bug

unable to get the result object from the sample example and getting following error

_Traceback (most recent call last): File "D:\users\consult\2022\resmed\phase1\bom_analyzer_pyansys.py", line 5, in result = cxn.run(query) File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\grantami\bomanalytics_connection.py", line 319, in run return query._run_query(api_instance=api_instance, static_arguments=self._query_arguments) File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\grantami\bomanalytics\queries.py", line 741, in _run_query self._call_api(api_method, arguments) File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\grantami\bomanalytics\queries.py", line 521, in _call_api response = api_method(request) File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\grantami\bomanalytics_openapi\api\impacted_substances_api.py", line 114, in post_impactedsubstances_materials (data) = self.post_impactedsubstances_materials_with_http_info(body, **kwargs) # noqa: E501 File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\grantami\bomanalytics_openapi\api\impacted_substances_api.py", line 170, in post_impactedsubstances_materials_with_http_info return self.api_client.call_api( File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\openapi\common_api_client.py", line 432, in call_api return self.__call_api( File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\openapi\common_api_client.py", line 166, in __call_api response_data = self.request( File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\openapi\common_api_client.py", line 518, in request return handle_response( File "D:\users\consult\2022\resmed\phase1\venv\lib\site-packages\ansys\openapi\common_util.py", line 412, in handle_response raise ApiException.from_response(response) ansys.openapi.common.exceptions.ApiException: ApiException(404, 'Not Found') HTTP response headers: {'Cache-Control': 'private', 'Server': 'Microsoft-IIS/10.0', 'Persistent-Auth': 'true', 'X-Frame-Options': 'SAMEORIGIN', 'X-Content-Type-Options': 'nosniff', 'Strict-Transport-Security': 'max-age=31536000', 'Date': 'Wed, 27 Jul 2022 14:44:13 GMT', 'Content-Length': '0'}

📝 Steps to reproduce

from ansys.grantami.bomanalytics import Connection, queries server_url = "http://PUNHSAHIRE/mi_servicelayer" cxn = Connection(server_url).with_autologon().connect() query = queries.MaterialImpactedSubstancesQuery().with_material_ids(["plastic-abs-high-impact"]).with_legislations(["REACH - The Candidate List"]) result = cxn.run(query)

💻 Which operating system are you using?

Windows

🐍 Which Python version are you using?

3.10

📦 Installed packages

ansys-grantami-bomanalytics==1.0.1
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-openapi-common==1.1.0
anyio==3.6.1
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
asttokens==2.0.5
attrs==21.4.0
Babel==2.10.3
backcall==0.2.0
beautifulsoup4==4.11.1
bleach==5.0.1
certifi==2022.6.15
cffi==1.15.1
charset-normalizer==2.1.0
colorama==0.4.5
cryptography==37.0.2
debugpy==1.6.2
decorator==5.1.1
defusedxml==0.7.1
entrypoints==0.4
executing==0.9.1
fastjsonschema==2.16.1
idna==3.3
importlib-metadata==3.4.0
ipykernel==6.15.1
ipython==8.4.0
ipython-genutils==0.2.0
jedi==0.18.1
Jinja2==3.1.2
json5==0.9.8
jsonschema==4.7.2
jupyter-client==7.3.4
jupyter-core==4.11.1
jupyter-server==1.18.1
jupyterlab==3.2.8
jupyterlab-pygments==0.2.2
jupyterlab-server==2.15.0
keyring==22.0.1
lxml==4.7.1
MarkupSafe==2.1.1
matplotlib-inline==0.1.3
MIScriptingToolkit @ file:///E:/setups/GRANTAMIENTERPRISE_2022R2_WINX64%20%281%29/Software/Scripting%20Toolkit%20for%20Python%20v3.0.0/Installers/Windows/MIScriptingToolkit-3.0.16-py3-none-win_amd64.whl
mistune==0.8.4
nbclassic==0.4.3
nbclient==0.6.6
nbconvert==6.5.0
nbformat==5.4.0
nest-asyncio==1.5.5
notebook-shim==0.1.0
ntlm-auth==1.5.0
numpy==1.23.1
packaging==21.3
pandas==1.3.5
pandocfilters==1.5.0
parso==0.8.3
pickleshare==0.7.5
prometheus-client==0.14.1
prompt-toolkit==3.0.30
psutil==5.9.1
pure-eval==0.2.2
pycparser==2.21
Pygments==2.12.0
pyparsing==3.0.9
pypiwin32==223
pyrsistent==0.18.1
python-dateutil==2.8.2
pytz==2022.1
pywin32==304
pywin32-ctypes==0.2.0
pywinpty==2.0.6
pyzmq==23.2.0
requests==2.28.1
requests-auth==5.2.0
requests-negotiate-sspi==0.5.2
requests-ntlm==1.1.0
Send2Trash==1.8.0
six==1.16.0
sniffio==1.2.0
soupsieve==2.3.2.post1
stack-data==0.3.0
tabulate==0.8.9
terminado==0.15.0
tinycss2==1.1.1
tornado==6.2
traitlets==5.3.0
urllib3==1.26.9
wcwidth==0.2.5
webencodings==0.5.1
websocket-client==1.3.3
zipp==3.8.1
Andy-Grigg commented 2 years ago

Hi @hsahire, thank you for reporting this issue!

Can you confirm you have the BoM Analytics service installed in your MI Service Layer? There are two ways to check this:

  1. Go to your servicelayer page (http://punhsahire/mi_servicelayer) and check that you see "BomAnalyticsServices: Serving at BomAnalytics/v1.svc" under the "External Services Available" heading
  2. Click the following link: http://punhsahire/mi_servicelayer/BomAnalytics/v1.svc/yaml and confirm that a yaml document is downloaded

If those steps don't work, you will need to install the RS Reports Bundle, which will install BomAnalyticsServices. There is currently not an official release of this for 2022 R2, but you should be able to find the RS bundle available for 2022 R1 under the "Materials Supplimentary" heading on the Customer Portal.

hsahire commented 2 years ago

Hi @Andy-Grigg thanks for the help. I am able to run the analytics using latest version of RS Reports Bundle

Andy-Grigg commented 2 years ago

Closing, will be resolved by #215