Unable to use Python plugin

I am having issues when using Python plugin.
It cant import opentap.


I have installed Python 3.12.3
And with these packages:

Any idea?

To address the issue with the Python plugin that cannot import OpenTAP, ensure the following steps:

  1. Verify Python Installation: Confirm Python 3.12.3 is installed correctly and is the version being used when attempts are made to run the plugin.

  2. Check Environment Variables: Make sure that the PYTHONHOME and PYTHONPATH environment variables are set correctly to point to your Python installation and the OpenTAP Python library respectively.

  3. Update OpenTAP: You mentioned using OpenTAP 9.19.0. Verify if this version is compatible with Python Plugin v3.0.2—consider updating OpenTAP if necessary or using the Python plugin version compatible with your OpenTAP version.

  4. Inspect Python Plugin Installation: Ensure that the plugin has been correctly installed. In your case, it appears that the .py files are not being copied to the correct location during the installation. The presence of only the DLL file suggests an incomplete installation. Investigate and resolve the package manager behavior that is leading to this incomplete installation.

  5. Review Debug Logging: Since the debug logging is not providing additional information, increase the logging level to capture more detailed information that could indicate the cause of the issue.

  6. OpenTap Integration: Review the documentation here on how to correctly integrate Python with OpenTAP and ensure all steps are properly followed.

  7. Check Compatibility: Be aware of any compatibility issues between different versions of the Python plugin and OpenTAP. Stick to compatible versions if you do not wish to upgrade.

  8. Post an Issue: As per the suggestion made in the context, consider posting the issue on the OpenTAP/Plugins/python Issues page on GitLab with details of your problem for community support.

  9. DLL Issues: If you encounter errors like “Unable to load python: The type initializer for ‘Delegates’ threw an exception,” it means there is a problem initializing the Python runtime. This might require additional troubleshooting or support from OpenTAP developers.

Helpful Source:

Unable to use Steps, generated with Python Plugin in example from `TapApiFromPython`


Disclaimer: I am an AI Helper, my responses are supplementary solutions for you to use while waiting for our developers to get back to you.

Hi @mschmidt and welcome to the forum.

Could you explain a bit how you start the application and what kind of error message you get?

I am just trying to play with the Python examples.

Sure, but I just need a bit more information in order to help you.

You are saying it cannot import OpenTAP, what do you mean by “it”? And at what point does this issue occur?

Hi Rolf, Thank you for your reply. At the first picture you can se I have opened the Python Example and there is the “Import opentap” underlined. VS code is telling that it cant find the library “opentap”.
I hope this makes a bit more sense?

Ok, got it.

Actually that is not an error but a warning that comes from interfacing Python code to the .NET Assemblies.

We are working on a solution for that.

In the mean time I suggest you refer to the examples for information on how to do specific things with the OpenTAP api. You can also checkout additional information on https://doc.opentap.io most of that should be translateable to the Python API.