ansys / pydynamicreporting

Pyansys project for Ansys Dynamic Reporting, a report generator tool.
https://dynamicreporting.docs.pyansys.com/
MIT License
7 stars 3 forks source link

server.export_report_as_pdf() does not work #66

Closed susannehaase closed 10 months ago

susannehaase commented 12 months ago

🔍 Before submitting the issue

🐞 Description of the bug

I tried to call server.export_report_as_pdf(template_003.guid, r"D:\temp\test_report.pdf")

Error Message:


  File ~\.ansys_python_venvs\v2023R2\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File d:\support\pyansys\pydynamicreporting\test.py:308
    server.export_report_as_pdf(template_003.guid, r"D:\temp\test_report.pdf")

  File ~\.ansys_python_venvs\v2023R2\lib\site-packages\ansys\dynamicreporting\core\utils\report_remote_server.py:886 in export_report_as_pdf
    run_nexus_utility(

  File ~\.ansys_python_venvs\v2023R2\lib\site-packages\ansys\dynamicreporting\core\utils\report_remote_server.py:81 in run_nexus_utility
    subprocess.call(args=cmd, **params)

  File C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py:345 in call
    with Popen(*popenargs, **kwargs) as p:

  File ~\.ansys_python_venvs\v2023R2\lib\site-packages\spyder_kernels\customize\spydercustomize.py:109 in __init__
    super(SubprocessPopen, self).__init__(*args, **kwargs)

  File C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py:971 in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,

  File C:\Program Files\ANSYS Inc\v232\commonfiles\CPython\3_10\winx64\Release\python\lib\subprocess.py:1440 in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,

FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden```

### 📝 Steps to reproduce

My sample code is based on this example [https://dynamicreporting.docs.pyansys.com/version/stable/examples/50-advanced/00-complete_report.html#sphx-glr-examples-50-advanced-00-complete-report-py](url)

```# -*- coding: utf-8 -*-
"""
Created on Fri Oct  6 09:53:34 2023

@author: shaase
"""

import numpy as np

import ansys.dynamicreporting.core as adr

ansys_loc = r"C:\Program Files\ANSYS Inc\v232"
db_dir = r"D:\temp\new_database"
port = 20328
adr_service = adr.Service(ansys_installation=ansys_loc, db_directory=db_dir, port=port)
session_guid = adr_service.start(create_db=True)

adr_service = adr.Service(ansys_installation=ansys_loc, db_directory=db_dir)
adr_service.connect(url=f"http://localhost:{port}")
server = adr_service.serverobj

template_003 = server.create_template(
    name="Solution Analysis from Multiphysics simulation", parent=None, report_type="Layout:basic"
)
template_003.params = '{"HTML": "<h1>Solution Report</h1>"}'
template_003.set_filter("A|i_tags|cont|solution=solverA;")
server.put_objects(template_003)

template_011 = server.create_template(
    name="Project Details", parent=template_003, report_type="Layout:basic"
)
template_011.params = (
    '{"TOCitems": 1, "HTML": "<h2>Project Details</h2>", "properties": {"justification": "left"}}'
)
template_011.set_filter("A|i_type|cont|html,string;A|i_tags|cont|text=project_details;")
server.put_objects(template_011)
server.put_objects(template_003)

template_000 = server.create_template(name="TOC", parent=template_003, report_type="Layout:toc")
template_000.params = '{"TOCitems": 1, "HTML": "<h2>Table of Contents</h2>"}'
template_000.set_filter("A|i_name|eq|__NonexistantName__;")
server.put_objects(template_000)
server.put_objects(template_003)

template_004 = server.create_template(
    name="TOC Figures", parent=template_003, report_type="Layout:toc"
)
template_004.params = (
    '{"TOCitems": 0, "TOCfigures": 1, "HTML": "<h2>List of Figures</h2>", "TOCtables": 0}'
)
template_004.set_filter("A|i_name|eq|__NonexistantName__;")
server.put_objects(template_004)
server.put_objects(template_003)

template_014 = server.create_template(
    name="Introduction", parent=template_003, report_type="Layout:panel"
)
template_014.params = '{"TOCitems": 1, "HTML": "<h2>Introduction</h2>", "properties": {"TOCItem": "1", "TOCLevel": "0"}}'
template_014.set_filter("A|i_tags|cont|section=intro;")
server.put_objects(template_014)
server.put_objects(template_003)

template_015 = server.create_template(name="text", parent=template_014, report_type="Layout:basic")
template_015.params = '{"properties": {"TOCItem": "0", "justification": "left"}}'
template_015.set_filter("A|i_type|cont|html,string;")
server.put_objects(template_015)
server.put_objects(template_014)
server.put_objects(template_003)

template_016 = server.create_template(name="img", parent=template_014, report_type="Layout:basic")
template_016.params = (
    '{"properties": {"TOCName": "Multiphysics Workflow", "TOCItem": "", "TOCFigure": "1"}}'
)
template_016.set_filter("A|i_type|cont|image;")
server.put_objects(template_016)
server.put_objects(template_014)
server.put_objects(template_003)

template_005 = server.create_template(
    name="CAD Model Summary", parent=template_003, report_type="Layout:panel"
)
template_005.params = '{"TOCitems": 1, "HTML": "<h2>CAD Model Summary</h2>", "properties": {"TOCItem": "1", "TOCLevel": "0"}}'
template_005.set_filter("A|i_tags|cont|section=cad_summary;")
server.put_objects(template_005)
server.put_objects(template_003)

template_010 = server.create_template(
    name="Summary of the Design Analysis", parent=template_005, report_type="Layout:basic"
)
template_010.params = (
    '{"HTML": "<h3>Summary of the Design Analysis</h3>", "properties": {"TOCLevel": "1"}}'
)
server.put_objects(template_010)
server.put_objects(template_005)
server.put_objects(template_003)

template_018 = server.create_template(
    name="table_params", parent=template_010, report_type="Layout:basic"
)
template_018.params = '{"properties": {"TOCItem": "2"}}'
template_018.set_filter("A|i_type|cont|table;")
server.put_objects(template_018)
server.put_objects(template_010)
server.put_objects(template_005)
server.put_objects(template_003)

template_017 = server.create_template(name="img", parent=template_010, report_type="Layout:basic")
template_017.params = (
    '{"properties": {"TOCItem": "0", "TOCName": "CAD Configuration", "TOCFigure": "1"}}'
)
template_017.set_filter("A|i_type|cont|image;")
server.put_objects(template_017)
server.put_objects(template_010)
server.put_objects(template_005)
server.put_objects(template_003)

template_006 = server.create_template(
    name="Preliminary Analysis Summary", parent=template_003, report_type="Layout:panel"
)
template_006.params = '{"TOCitems": 1, "HTML": "<h2>Preliminary Analysis Summary</h2>", "properties": {"TOCItem": "1", "TOCLevel": "0"}}'
template_006.set_filter("A|i_tags|cont|section=preliminar_summary;")
server.put_objects(template_006)
server.put_objects(template_003)

template_012 = server.create_template(
    name="Results Summary for Preliminary Analysis", parent=template_006, report_type="Layout:basic"
)
template_012.params = (
    '{"HTML": "<h3>Result summary for Preliminar Analysis</h3>", "properties": {"TOCLevel": "1"}}'
)
server.put_objects(template_012)
server.put_objects(template_006)
server.put_objects(template_003)

template_019 = server.create_template(name="img", parent=template_012, report_type="Layout:basic")
template_019.params = (
    '{"properties": {"TOCItem": "0", "TOCName": "Discovery CAD", "TOCFigure": "1"}}'
)
template_019.set_filter("A|i_type|cont|image;")
server.put_objects(template_019)
server.put_objects(template_012)
server.put_objects(template_006)
server.put_objects(template_003)

template_002 = server.create_template(
    name="table_params", parent=template_012, report_type="Layout:basic"
)
template_002.params = '{"properties": {"TOCItem": "2"}}'
template_002.set_filter("A|i_type|cont|table;")
server.put_objects(template_002)
server.put_objects(template_012)
server.put_objects(template_006)
server.put_objects(template_003)

template_007 = server.create_template(
    name="Detailed Analysis Summary", parent=template_003, report_type="Layout:panel"
)
template_007.params = '{"TOCitems": 1, "HTML": "<h2>Detailedy Analysis Summary</h2>\\nDetailed analysis constitutes detailed CFD (Computational Fluid Dynamics) analysis workflow with fluid solver and required data is transferred back to the CAD calibration.", "properties": {"TOCItem": "1", "TOCLevel": "0"}}'
template_007.set_filter("A|i_tags|cont|section=detailed_summary;")
server.put_objects(template_007)
server.put_objects(template_003)

template_020 = server.create_template(name="img", parent=template_007, report_type="Layout:basic")
template_020.params = '{"properties": {"TOCItem": "0", "TOCName": "Mesh Review", "TOCFigure": "1"}}'
template_020.set_filter("A|i_type|cont|image;")
server.put_objects(template_020)
server.put_objects(template_007)
server.put_objects(template_003)

template_013 = server.create_template(
    name="Mesh Summary", parent=template_007, report_type="Layout:basic"
)
template_013.params = (
    '{"properties": {"TOCItem": "1", "TOCLevel": "1"}, "HTML": "<h3>Mesh Summary</h3>"}'
)
template_013.set_filter("A|i_type|cont|table;A|i_tags|cont|table=meshsummary;")
server.put_objects(template_013)
server.put_objects(template_007)
server.put_objects(template_003)

template_021 = server.create_template(
    name="Results Summary of Detailed Analysis", parent=template_007, report_type="Layout:basic"
)
template_021.params = '{"properties": {"TOCItem": "1", "TOCLevel": "1"}, "HTML": "<h3>Results Summary of Detailed Analysis</h3>", "column_count": 1, "column_widths": [1.0]}'
template_021.set_filter("A|i_type|cont|table;A|i_tags|cont|table=results;")
server.put_objects(template_021)
server.put_objects(template_007)
server.put_objects(template_003)

template_001 = server.create_template(name="table", parent=template_021, report_type="Layout:basic")
template_001.params = '{"properties": {"TOCItem": ""}}'
template_001.set_filter("A|i_tags|cont|show=table;")
server.put_objects(template_001)
server.put_objects(template_021)
server.put_objects(template_007)
server.put_objects(template_003)

template_022 = server.create_template(name="plots", parent=template_021, report_type="Layout:basic")
template_022.params = '{"properties": {"TOCItem": "0", "plot": "line", "TOCFigure": "2", "xaxis": "0", "format": "floatdot0"}, "column_count": 2, "column_widths": [1.0, 1.0]}'
template_022.set_filter("A|i_tags|cont|show=plot;")
server.put_objects(template_022)
server.put_objects(template_021)
server.put_objects(template_007)
server.put_objects(template_003)

template_008 = server.create_template(
    name="Results & Conclusion", parent=template_003, report_type="Layout:panel"
)
template_008.params = '{"TOCitems": 1, "HTML": "<h2>Results & Conclusion</h2>", "properties": {"TOCItem": "1", "TOCLevel": "0"}}'
template_008.set_filter("A|i_tags|cont|section=results;")
server.put_objects(template_008)
server.put_objects(template_003)

template_009 = server.create_template(
    name="Results", parent=template_008, report_type="Layout:basic"
)
template_009.params = '{"properties": {"TOCItem": "1", "TOCLevel": "1"}, "HTML": "<h3>Results</h3>\\nResults are feedback for model calibrarion and detailed summary of results as below."}'
template_009.set_filter("A|i_type|cont|image;")
server.put_objects(template_009)
server.put_objects(template_008)
server.put_objects(template_003)

template_023 = server.create_template(
    name="References", parent=template_003, report_type="Layout:basic"
)
template_023.params = '{"TOCitems": 1, "HTML": "<h3>References</h3>", "properties": {"TOCItem": "1", "TOCLevel": "0", "justification": "left"}}'
template_023.set_filter("A|i_tags|cont|section=references;")
server.put_objects(template_023)
server.put_objects(template_003)

adr_service.get_list_reports()

a = adr_service.create_item(obj_name="introduction")
a.item_text = "Project Name: Multiphysics Solution<p></p><p></p>\r\n\r\nNote:  <p></p>\r\n\r\n[Images/Json data/plots/tables etc., are getting generated on the fly at each step and getting saved to Ansys Dynamic Reporting database with appropriate tags, based on the report requirement. The report will be generated with pre-defined template] \r\n"
a.set_tags("solution=solverA text=project_details")
b = adr_service.create_item(obj_name="Description")
b.item_text = "[some static content] <p></p>\r\nThe workflow provides calibrarion of the CAD model by high-fidelity 3D physics based solution. \r\nThis workflow ensures model consistency through design cycle - from CAD via Discovery to advanced Electronic-Fluid multi-physics.\r\n"
b.set_tags("solution=solverA section=intro")
b.get_tags()
c = adr_service.create_item(obj_name="Schema")
c.item_image = r"D:\temp\schema.png"
c.set_tags("solution=solverA section=intro")
d = adr_service.create_item(obj_name="Schema")
d.item_image = r"D:\temp\sections.png"
d.set_tags("solution=solverA section=cad_summary")
e = adr_service.create_item(obj_name="Schema")
e.item_image = r"D:\temp\preliminary.png"
e.set_tags("solution=solverA section=preliminar_summary")
f = adr_service.create_item(obj_name="Schema")
f.item_image = r"D:\temp\solution.png"
f.set_tags("solution=solverA section=detailed_summary")
g = adr_service.create_item(obj_name="param_input")
g.table_dict["rowlbls"] = [
    "Inlet Temperature",
    "Total Losses",
    "Inlet Flow Rate",
    "Shaft Temperature",
    "Shaft Flow Rate",
]
g.item_table = np.array([["67"], ["1.25"], ["4.2"], ["67"], ["4.2"]], dtype="|S20")
g.set_tags("solution=solverA section=cad_summary")
h = adr_service.create_item(obj_name="preliminary_table")
h.table_dict["rowlbls"] = [
    "Max Domain Temp [Celsius]",
    "Water Pressure [Pa]",
    "Water Outlet Temp [Celsius]",
]
h.item_table = np.array([["177"], ["400"], ["67"]], dtype="|S20")
h.set_tags("solution=solverA section=preliminar_summary")
i = adr_service.create_item(obj_name="detailed_mesh_table")
i.table_dict["rowlbls"] = ["Total Cell Count", "Min Orthogal Quality", "Max aspect ratio", "Wrap"]
i.item_table = np.array([["626037"], ["0.2"], ["17.59"], ["0.4"]], dtype="|S20")
i.set_tags("solution=solverA section=detailed_summary table=meshsummary")
table = adr_service.create_item(obj_name="detailed_res_table")
table.table_dict["rowlbls"] = [
    "Max Domain Temp [Celsius]",
    "Water Pressure Drop [Pa]",
    "Water Outlet Temperature [Celsius]",
]
table.item_table = np.array([["177"], ["500"], ["67"]], dtype="|S20")
table.set_tags("show=table table=results section=detailed_summary solution=solverA")
m = adr_service.create_item(obj_name="monitors")
m.table_dict["rowlbls"] = ["Iteration", "Monitor Parameter"]
m.item_table = np.array(
    [
        ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
        ["100", "90", "93", "88", "76", "71", "66", "60", "55", "53", "52"],
    ],
    dtype="|S20",
)
m.set_tags("show=plot table=results section=detailed_summary solution=solverA")
n = adr_service.create_item(obj_name="Convergence")
n.table_dict["rowlbls"] = ["Iteration", "Val 1", "Val 2", "Val 3"]
n.item_table = np.array(
    [
        ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"],
        ["100", "90", "70", "60", "30", "20", "15", "15", "14", "13", "15"],
        ["87", "85", "81", "80", "73", "60", "46", "20", "18", "17", "10"],
        ["77", "73", "55", "53", "51", "47", "44", "30", "32", "20", "18"],
    ],
    dtype="|S20",
)
n.set_tags("show=plot table=results section=detailed_summary solution=solverA")
o = adr_service.create_item(obj_name="references")
o.item_text = "<ul>\r\n  <li>Author, A. B. C., Author D. E., ... , Publication Year, Book, title, Publisher.</li>\r\n  <li>Author, F. G. H., Author I. J., ... , Publication Year, Book, title, Publisher.</li>\r\n</ul>"
o.set_tags("solution=solverA section=references")

server.export_report_as_pdf(template_003.guid, r"D:\temp\test_report.pdf")
adr_service.visualize_report(report_name="Solution Analysis from Multiphysics simulation")

# sphinx_gallery_thumbnail_path = '_static/00_complete_report_0.png'
#adr_service.stop()```

Everything works fine, except the pdf creation at the end.

### 💻 Which operating system are you using?

Windows

### 📀 Which ANSYS version are you using?

2023R2

### 🐍 Which Python version are you using?

3.10

### 📦 Installed packages

```shell
aiohttp==3.8.5
aiosignal==1.3.1
alabaster==0.7.13
ansys-api-dyna==0.3.2
ansys-api-fluent==0.3.12
ansys-api-geometry==0.2.12
ansys-api-mapdl==0.5.1
ansys-api-mechanical==0.1.0
ansys-api-meshing-prime==0.1.1
ansys-api-platform-instancemanagement==1.0.0b3
ansys-api-pyensight==0.3.0
ansys-api-sherlock==0.1.14
ansys-api-systemcoupling==0.1.0
ansys-dpf-composites==0.2.0
ansys-dpf-core==0.8.1
ansys-dpf-gate==0.3.1
ansys-dpf-gatebin==0.3.1
ansys-dpf-post==0.4.0
ansys-dyna-core==0.4.2
ansys-dynamicreporting-core==0.4.0
ansys-fluent-core==0.14.0
ansys-grantami-bomanalytics==1.1.3
ansys-grantami-bomanalytics-openapi==1.0.0
ansys-grantami-recordlists==1.0.0
ansys-grantami-serverapi-openapi==1.0.0
ansys-grpc-dpf==0.7.1
ansys-mapdl-core==0.64.1
ansys-mapdl-reader==0.52.20
ansys-math-core==0.1.1
ansys-mechanical-core==0.8.0
ansys-meshing-prime==0.4.1
ansys-motorcad-core==0.1.3
ansys-openapi-common==1.2.1
ansys-optislang-core==0.2.1
ansys-platform-instancemanagement==1.1.1
ansys-pyensight-core==0.5.3
ansys-pythonnet==3.1.0rc1
ansys-seascape==0.2.0
ansys-sherlock-core==0.2.0
ansys-systemcoupling-core==0.1.3
ansys-tools-path==0.3.1
anyio==3.7.1
appdirs==1.4.4
argon2-cffi==21.3.0
argon2-cffi-bindings==21.2.0
arrow==1.2.3
asgiref==3.7.2
astroid==2.15.6
asttokens==2.2.1
async-lru==2.0.4
async-timeout==4.0.2
atomicwrites==1.4.1
attrs==23.1.0
autopep8==2.0.2
Babel==2.12.1
backcall==0.2.0
bcrypt==4.0.1
beautifulsoup4==4.12.2
binaryornot==0.4.4
black==23.7.0
bleach==6.0.0
build==0.10.0
cachetools==5.3.1
certifi==2023.7.22
cffi==1.15.1
chardet==5.2.0
charset-normalizer==3.2.0
click==8.1.6
cloudpickle==2.2.1
clr-loader==0.2.5
colorama==0.4.6
comm==0.1.4
contourpy==1.1.0
cookiecutter==2.3.0
cryptography==41.0.3
cycler==0.11.0
debugpy==1.6.7.post1
decorator==5.1.1
defusedxml==0.7.1
diff-match-patch==20230430
dill==0.3.7
Django==4.2.4
docstring-to-markdown==0.12
docutils==0.20.1
exceptiongroup==1.1.2
executing==1.2.0
fastjsonschema==2.18.0
filelock==3.12.2
flake8==6.0.0
fonttools==4.41.1
fqdn==1.5.1
frozenlist==1.4.0
geomdl==5.3.1
google-api-core==2.11.1
google-api-python-client==2.95.0
google-auth==2.22.0
google-auth-httplib2==0.1.0
googleapis-common-protos==1.60.0
grpcio==1.56.2
grpcio-status==1.48.2
h5py==3.9.0
httplib2==0.22.0
idna==3.4
imagesize==1.4.1
importlib-metadata==6.8.0
inflection==0.5.1
intervaltree==3.1.0
ipykernel==6.25.1
ipython==8.14.0
ipython-genutils==0.2.0
ipywidgets==8.1.0
isoduration==20.11.0
isort==5.12.0
jaraco.classes==3.3.0
jedi==0.18.2
jellyfish==1.0.0
Jinja2==3.1.2
joblib==1.3.1
json5==0.9.14
jsonpointer==2.4
jsonschema==4.19.0
jsonschema-specifications==2023.7.1
jupyter==1.0.0
jupyter-console==6.6.3
jupyter-events==0.7.0
jupyter-lsp==2.2.0
jupyter_client==8.3.0
jupyter_core==5.3.1
jupyter_server==2.7.0
jupyter_server_terminals==0.4.4
jupyterlab==4.0.4
jupyterlab-pygments==0.2.2
jupyterlab-widgets==3.0.8
jupyterlab_server==2.24.0
keyring==24.2.0
kiwisolver==1.4.4
lazy-object-proxy==1.9.0
lxml==4.9.3
markdown-it-py==3.0.0
MarkupSafe==2.1.3
matplotlib==3.7.2
matplotlib-inline==0.1.6
mccabe==0.7.0
mdurl==0.1.2
mistune==3.0.1
more-itertools==10.0.0
multidict==6.0.4
mypy-extensions==1.0.0
nbclient==0.8.0
nbconvert==7.7.3
nbformat==5.9.2
nest-asyncio==1.5.7
notebook==7.0.2
notebook_shim==0.2.3
numpy==1.25.2
numpydoc==1.5.0
overrides==7.4.0
packaging==23.1
pandas==2.0.3
pandocfilters==1.5.0
paramiko==3.3.1
parso==0.8.3
pathspec==0.11.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==10.0.0
pkginfo==1.9.6
platformdirs==3.10.0
pluggy==1.2.0
plumbum==1.8.2
pooch==1.7.0
prometheus-client==0.17.1
prompt-toolkit==3.0.39
protobuf==3.20.3
protoc-gen-swagger==0.1.0
psutil==5.9.5
ptyprocess==0.7.0
pure-eval==0.2.2
pyaedt==0.6.76
pyansys==2023.2.11
pyansys-docker==5.0.4
pyansys-tools-versioning==0.4.0
pyasn1==0.5.0
pyasn1-modules==0.3.0
pycodestyle==2.10.0
pycparser==2.21
pydocstyle==6.3.0
pyflakes==3.0.1
Pygments==2.15.1
pyiges==0.3.1
pylint==2.17.5
pylint-venv==3.0.2
pyls-spyder==0.4.0
PyNaCl==1.5.0
pyparsing==3.0.9
pypiwin32==223
pypng==0.20220715.0
pyproject_hooks==1.0.0
PyQt5==5.15.9
PyQt5-Qt5==5.15.2
PyQt5-sip==12.12.2
PyQtWebEngine==5.15.6
PyQtWebEngine-Qt5==5.15.2
pyspnego==0.9.1
python-dateutil==2.8.2
python-json-logger==2.0.7
python-lsp-black==1.3.0
python-lsp-jsonrpc==1.0.0
python-lsp-server==1.7.4
python-slugify==8.0.1
pythonnet==3.0.1
pytoolconfig==1.2.5
pytwin==0.3.0
pytz==2023.3
pyvista==0.40.3
pywin32==306
pywin32-ctypes==0.2.2
pywinpty==2.0.11
PyYAML==6.0.1
pyzmq==25.1.0
QDarkStyle==3.1
qstylizer==0.2.2
QtAwesome==1.2.3
qtconsole==5.4.3
QtPy==2.3.1
readme-renderer==40.0
referencing==0.30.2
requests==2.31.0
requests-negotiate-sspi==0.5.2
requests-ntlm==1.2.0
requests-toolbelt==1.0.0
rfc3339-validator==0.1.4
rfc3986==2.0.0
rfc3986-validator==0.1.1
rich==13.5.2
rope==1.9.0
rpds-py==0.9.2
rpyc==5.3.1
rsa==4.9
Rtree==1.0.1
scikit-learn==1.3.0
scipy==1.11.1
scooby==0.7.2
Send2Trash==1.8.2
six==1.16.0
sniffio==1.3.0
snowballstemmer==2.2.0
sortedcontainers==2.4.0
soupsieve==2.4.1
Sphinx==7.1.2
sphinxcontrib-applehelp==1.0.5
sphinxcontrib-devhelp==1.0.3
sphinxcontrib-htmlhelp==2.0.2
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.4
sphinxcontrib-serializinghtml==1.1.6
spyder==5.4.4
spyder-kernels==2.4.4
sqlparse==0.4.4
stack-data==0.6.2
terminado==0.17.1
text-unidecode==1.3
textdistance==4.5.0
threadpoolctl==3.2.0
three-merge==0.1.1
tinycss2==1.2.1
tomli==2.0.1
tomlkit==0.12.1
tornado==6.3.2
tqdm==4.65.0
traitlets==5.9.0
trame==3.1.0
trame-client==2.10.0
trame-server==2.11.7
twine==4.0.2
typing==3.7.4.3
typing_extensions==4.7.1
tzdata==2023.3
ujson==5.8.0
uri-template==1.3.0
uritemplate==4.1.1
urllib3==1.26.16
vtk==9.2.6
watchdog==3.0.0
wcwidth==0.2.6
webcolors==1.13
webencodings==0.5.1
websocket-client==1.6.1
whatthepatch==1.0.5
widgetsnbextension==4.0.8
wrapt==1.15.0
wslink==1.11.1
yapf==0.40.1
yarl==1.9.2
zipp==3.16.2
mariostieriansys commented 11 months ago

@margalva I don't know if you've seen this

kmahajan-cadfem commented 10 months ago

we would like to place the dynamic reporting as only solution for creating report irrespective of the simulation and I think this was also the idea behind this Tool/package. could you please look into the issue, this is important for going forward and placing the pyansys solutions by our customers.

Thanks in advance

margalva commented 10 months ago

Apologies for the delay in the answer. The problem is that you need to pass also the location of the executable and Ansys release version as arguments to the save to pdf method. So if you run:

server.export_report_as_pdf(template_003, r"D:\temp\test_report.pdf", exec_basis=r"C:\Program Files\ANSYS Inc\v232\CEI", ansys_version=232)

it will create the PDF file (note: the ansys_version argument is an integer, while the exec_basis argument is a string for the path). From my tests, this works correctly.

This issue points to the fact that indeed we need a better wrapper around this report export capability - but the functionality should be there and work as of now.

I'll therefore close this issue, but please don't hesitate to open it back up if you run into any issues. Thanks.

susannehaase commented 10 months ago

Hi Marina, with your solution I get a pdf, but it only shows "Oops! Error Code: 500, Sorry but something went wrong with the server. Please try again." See pdf attached. test_report.pdf Do you know what's causing this? Best regards, Susanne

margalva commented 10 months ago

Hi Susanne, it sounds like the issue is not in the PDF export but in the ADR service or the data itself. If you run the script all the way to the line:

o.set_tags("solution=solverA section=references")

(included), then open a web browser and go to the web interface at:

http://localhost:20328

what do you see? Can you query the database and see all the data there? Can you go into the report and see the report correctly?

It is possible that you have two ADR services on your machine that are competing for the same port or something similar.

kmahajan-cadfem commented 10 months ago

@margalva, I just did the deep dive and seems this is just the copy paste mistake, in your comment you have mentioned first argument as template_003 which should be template_003.guid, right?

obviously tool cannot find any reports with GUID template_003

@susannehaase: can you please test following line, it did the trick for me

server.export_report_as_pdf(template_003.guid, r"D:\temp\test_report.pdf", exec_basis=r"C:\Program Files\ANSYS Inc\v232\CEI", ansys_version=232)
susannehaase commented 10 months ago

Thank you @kmahajan-cadfem! The guid was missing. Now it works! Also many thanks to @margalva Marina, for your support!