When I run my PyTecplot Python script, I receive a TypeError, ValueError, KeyError, or AttributeError. However, I recorded this script from the 360 user interface, or wrote it using the current Pytecplot documentation, so it should be correct. What is causing this error?
For example, running a recorded script using plot.fieldmaps(6,7,8,9,10,11) with PyTecplot 1.0 gives the following error:
Traceback (most recent call last): File "C:\recorded_pytecplot.py", line 17, in <module> tp.active_frame().plot().fieldmaps(6,7,8,9,10,11).mesh.show=False TypeError: fieldmaps() takes 1 positional argument but 7 were given
Or, if you run dataset.mirror_zones() using PyTecplot 0.14.0, an AttributeError is thrown:
Traceback (most recent call last): File ".\recorded_pytecplot.py", line 8, in <module> tp.active_frame().dataset.mirror_zones(,[0,1,2,3,4,5,6,7,8,9,10,11]) AttributeError: 'Dataset' object has no attribute 'mirror_zones'
It is likely that you are using an out-of-date version of PyTecplot. Scripts recorded in Tecplot 360 use the most up-to-date syntax. If you are using an older version of PyTecplot, some functions may not exist or have additional parameters.
To fix this problem, update PyTecplot to the latest version. Typically, this involves running the following command:
pip install --upgrade pytecplot
See the PyTecplot documentation for more detailed updating instructions for Windows, Linux, or MacOS. To get the current version of PyTecplot, run the following in the python interpreter:
import tecplot print(tecplot.__version__)
PyTecplot adheres to the semantic versioning as outlined in SemVer 2.0.0 with regard to backwards compatibility between releases. For this purpose, the public interface of PyTecplot is defined as all entities (functions, properties etc.) presented in the HTML documentation and does not include methods in the code-base which do not show up in the HTML documentation, even when a docstring is present. In short, we will maintain backwards compatibility of the public interface between all minor releases of the same major version with the exception of internal changes that fix incorrect behavior or bugs.