ansys / ansys/pyfluent-visualization
Bug located in src/ansys/fluent/visualization/renderer.py
- Dominant language
- Python
- Stars
- 53
- Forks
- 7
- Avg merge
- 4h 58m
- Merged PRs (30d)
- 1
Description
### 🔍 Before submitting the issue
- [x] I have searched among the existing issues
- [x] I am using a Python virtual environment
### 🐞 Description of the bug
Encountering a KeyError in line 120 with key 'object'
In lines 89 (add_graphics) and 113 (add_plot), there is an ineffective attempt to change a key locals(). Eg. `locals()["object"] = locals().pop("plot_obj")`
Trace:
File "C:\Users\sld\pyEnvSimsam\Lib\site-packages\ansys\fluent\visualization\renderer.py", line 218, in save_graphics
self.renderer.save_graphic(filename)
^^^^^^^^^^^^^
File "C:\Users\sld\pyEnvSimsam\Lib\site-packages\ansys\fluent\visualization\renderer.py", line 223, in renderer
self._update_renderer()
~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\sld\pyEnvSimsam\Lib\site-packages\ansys\fluent\visualization\renderer.py", line 170, in _update_renderer
self._initialize_renderer()
~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "C:\Users\sld\pyEnvSimsam\Lib\site-packages\ansys\fluent\visualization\renderer.py", line 153, in _initialize_renderer
if self._all_plt_objs() and not pyviz.config.single_window:
~~~~~~~~~~~~~~~~~~^^
File "C:\Users\sld\pyEnvSimsam\Lib\site-packages\ansys\fluent\visualization\renderer.py", line 120, in _all_plt_objs
if not isinstance(obj["object"]._obj, PlotDefn):
~~~^^^^^^^^^^
KeyError: 'object'
### 📝 Steps to reproduce
Not easy to reproduce in place, i only encounter the problem on a certain Windows machine. Just run the code below and see how locals() is not altered.
`class A:
def bla(self, a):
print(locals())
locals().pop("a")
locals()["b"] = 2
print(locals())
a = A()
a.bla(1)`
### 💻 Which operating system are you using?
Windows
### 📀 Which ANSYS version are you using?
25R2
### 🐍 Which Python version are you using?
3.13
### 📦 Installed packages
```shell
ansys-api-dbu==0.3.28
ansys-api-fluent==0.3.36
ansys-api-geometry==0.4.83
ansys-api-platform-instancemanagement==1.1.3
ansys-api-tools-filetransfer==0.1.2
ansys-fluent-core==0.35.0
ansys-fluent-visualization==0.22.1
ansys-geometry-core==0.12.1
ansys-platform-instancemanagement==1.1.2
ansys-tools-common==0.2.1
ansys-tools-filetransfer==0.1.1
ansys-tools-path==0.8.1
ansys-units==0.8.1
appdirs==1.4.4
art==6.5
beartype==0.22.5
certifi==2025.10.5
charset-normalizer==3.4.4
click==8.3.0
colorama==0.4.6
contourpy==1.3.3
cycler==0.12.1
defusedxml==0.7.1
Deprecated==1.2.18
dirsync==2.2.6
docker==7.1.0
flexcache==0.3
flexparser==0.4
fonttools==4.60.1
geomdl==5.4.0
googleapis-common-protos==1.71.0
grpcio==1.76.0
grpcio-health-checking==1.62.3
grpcio-status==1.62.3
idna==3.11
importlib_metadata==8.7.0
Jinja2==3.1.6
joblib==1.5.2
kiwisolver==1.4.9
MarkupSafe==3.0.3
matplotlib==3.10.7
nltk==3.9.2
numpy==2.3.4
packaging==25.0
pandas==2.3.3
pillow==12.0.0
Pint==0.25.2
platformdirs==4.5.0
pooch==1.8.2
protobuf==4.25.8
pyansys-tools-report==0.8.2
pyparsing==3.2.5
python-dateutil==2.9.0.post0
pytz==2025.2
pyvista==0.46.4
pywin32==311
PyYAML==6.0.3
regex==2025.10.23
requests==2.32.5
scipy==1.16.3
scooby==0.10.2
semver==3.0.4
setuptools==80.9.0
six==1.17.0
tqdm==4.67.1
typing_extensions==4.15.0
tzdata==2025.2
urllib3==2.5.0
vtk==9.5.2
wrapt==1.17.3
zipp==3.23.0
```
Contributor guide
Assessment
This issue has not been assessed yet.