Setting Up Your Environment for Python Developers
You can use Python to write a Wiretap client that can run immediately, without compiling.
If you need to become familiar with Python, visit the website: http://www.python.org/
Availability of Python API
There is a pre-compiled version of the Wiretap Client API that was compiled with Python 3.11. It is only available for these platforms:
- Linux
- macOS
Using Flame Python Interpreter
The easiest way to use the Wiretap Python SDK is to use the Python interpreter installed with Flame Family products located in /opt/Autodesk/python/<version>/bin/python
. This installation is packaged with the Wiretap Python SDK, as well as third-parties compatible with the matching Flame Family products.
Other third-parties can be easily installed by using PIP (/opt/Autodesk/python/<version>/bin/pip3
).
Manual Installation of the Python Libraries from the SDK
Alternatively, the Wiretap Python Libraries can be installed to any Python 3.11 installation by copying the Python library files into the Python site-packages
folder.
You will find the appropriate version of the Wiretap dynamic library for Python in your wiretap_install_dir. The following table indicates the names of the library files, and the path to these files.
OS | Platform | Library Install Path | Python Library File Name |
---|---|---|---|
Linux | x86_64 |
<wiretap_install_dir>/lib/opt/LINUX/x86_64/... |
libwiretapPythonClientAPI.so |
macOS | x86_64 /arm64 |
<wiretap_install_dir>/lib/opt/MACOSX/fat/... |
libwiretapPythonClientAPI.so |
Building Up the Python Wiretap SDK
To use a version of Python other than the recommended version 3.11, or if your OS does not come with Python, set up your development environment using the following steps:
Ensure a dynamic library for boost (C++ extensions) is installed on your system:
If you are working on Linux or macOS, a boost dynamic library might have already been installed on your system.
If you do not have a boost library, you will need to build one from the sources available at:
For more details, see http://www.boost.org.
Ensure Python is installed on your system. Preferably, it should be version 3.11, because the dynamic library (that defines Python bindings for Wiretap) works correctly with it.
If you need to get Python, go to the Python website: http://www.python.org/
If you want to use a version of Python other than the pre-compiled version, you must regenerate the Wiretap dynamic library for Python as follows:
Compile
wiretapPythonClientAPI.C
(in thesamples
directory of the Wiretap Client SDK).Specify the boost library (from Step 1) in your compile command.
The resulting library must be named
libwiretapPythonClientAPI.so
, and must be installed as explained in the rest of this procedure.
See Compiling the samples from the command line for more details on setup required to compile C++ binding.
Check Location of Python Libraries to determine the location of the appropriate version of the Wiretap dynamic library for Python.
Ensure that the library files for boost are found at runtime by adding the path of the library files to your system path.
Running Python Modules
Once you have ensured that Python is installed, and can find the required libraries, you can run the sample Python modules (.py files) included in the Wiretap Client SDK.
Open a shell or command prompt and enter a command like this:
python wiretap_install_dir/samples/python/moduleName.py
With:
wiretap_install_dir
: The directory where you installed Wiretap.moduleName
: The name of the Python module to run.
Accessing Documentation for the Python API
The Wiretap Client SDK does not include documentation specifically for the Python version of the API. However, you can view the list of classes and their member functions in the API by using the Python commands dir
and help
as shown below.
To get help for the Python API:
Start Python, or open a shell or command prompt and enter:
python
The python prompt (
>>>
) appears.To import the Wiretap API (with an alias), enter:
import libwiretapPythonClientAPI as wiretap
To view a list of the classes in the API, enter:
dir(wiretap)
To view the members of a particular class in the API, enter:
help(wiretap.WireTapServerHandle)
To get more information about the methods of a class, consult the C++ API reference documentation. When you read the C++ version of the documentation, you must be aware of the differences between the two versions of the API, which are explained below.
Differences between the Python API and the C++ API
The Python API is designed to resemble the C++ API as much as possible. However, there are a few differences between the C++ and Python versions of the API. Unlike C++, Python does not support pointers and references. Python uses objects in situations where C++ would use pointers and references.
In the Wiretap Client API, some C++ accessor methods have output parameters that pass references to integers. The equivalent Python methods pass an instance of WireTapInt
, which is used to represent the int base type.
Affected Classes and Methods
These are the Python method declarations that differ from the equivalent C++ declarations:
class WireTapServerHandle
bool getVersion( WireTapInt &major, WireTapInt &minor ) const
bool getProtocolVersion( WireTapInt &major, WireTapInt &minor ) const
class WireTapNodeHandle
bool getNumAvailableMetaDataStreams( WireTapInt &numStreams ) const
bool getNumChildren( WireTapInt &numChildren ) const
bool getNumFrames( WireTapInt &numFrames ) const
bool getNodeType( WireTapInt &type ) const
bool linkToFrames( python::list pathList )
class WireTapServerList
bool getNumNodes( WireTapInt &numberOfNodes )