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?
I am having issues when using Python plugin.
It cant import opentap.
To address the issue with the Python plugin that cannot import OpenTAP, ensure the following steps:
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.
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.
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.
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.
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.
OpenTap Integration: Review the documentation here on how to correctly integrate Python with OpenTAP and ensure all steps are properly followed.
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.
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.
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.
Hello @rolf_madsen , @mschmidt ,
I am very new to OpenTAP and I am also having problems to get it to work with Python.
I keep seeing a “No Python installations found” message.
Specifically, I would like to be able to use it with Anaconda.
I tried to use both the python set-path and set-lib-path commands from the CLI and the Settings in the Editor GUI, but no luck so far.
Could you by any chance provide detailed examples on how to set this up?
Thanks!
Hi @msquillante,
Thanks for the question.
Actually, I have not tried it with Anaconda.
Could you elaborate a bit on your environment?
Hello Rolf,
Thank you for replying.
Everything should be 64 bit. Here some info about my setup:
C:\Program Files\OpenTAP>tap
No Python installations found.
OpenTAP Command Line Interface (9.27.1+49587562)
C:\Program Files\OpenTAP>tap package show Python
No Python installations found.
Package Name : Python
Version : 3.1.0+73e66d85 (3.1.0+73e66d85 installed)
Compatible Architectures : AnyCPU
(base) C:\Users\micheles>conda info
active environment : base
active env location : C:\Users\micheles\AppData\Local\anaconda3
shell level : 1
user config file : C:\Users\micheles\.condarc
populated config files : C:\Users\micheles\AppData\Local\anaconda3\.condarc
C:\Users\micheles\.condarc
conda version : 24.9.2
conda-build version : 24.9.0
python version : 3.12.7.final.0
solver : libmamba (default)
virtual packages : __archspec=1=skylake
__conda=24.9.2=0
__win=0=0
base environment : C:\Users\micheles\AppData\Local\anaconda3 (writable)
conda av data dir : C:\Users\micheles\AppData\Local\anaconda3\etc\conda
conda av metadata url : None
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\micheles\AppData\Local\anaconda3\pkgs
C:\Users\micheles\.conda\pkgs
C:\Users\micheles\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\micheles\AppData\Local\anaconda3\envs
C:\Users\micheles\.conda\envs
C:\Users\micheles\AppData\Local\conda\conda\envs
platform : win-64
Hopefully I am just missing something trivial somewhere. Thanks!
Everything looks good to me. Maybe you could try 3.2-rc of the Python plugin, some things could have been improved relating to resolving the installation.
Thank you for the suggestion. I gave it a try, but still see the same message, as in:
C:\Program Files\OpenTAP>tap package show Python
No Python installations found.
Could not unpack 'C:\Users\micheles\AppData\Local\OpenTap\PackageCache\NATS Server.1.1.0+0b98c8aa.x64.TapPackage'.
Package Name : Python
Version : 3.2.0-rc.3+15872c14 (3.2.0-rc.3+15872c14 installed)
Given that the conda installation is at:
(base) C:\Users\micheles>where conda
C:\Users\micheles\AppData\Local\anaconda3\Library\bin\conda.bat
C:\Users\micheles\AppData\Local\anaconda3\Scripts\conda.exe
C:\Users\micheles\AppData\Local\anaconda3\condabin\conda.bat
would you have a suggestion on how to set up tap python set-path and tap python set-lib-path?
I believe it should be sufficient to set these correctly, just my previous attempt seemed always unsuccessful.
Thanks again!
Where is libpython.dll located? That is the path that should be used by set-lib-path.
If its in a folder called Scripts, the Python path is the parent folder otherwise that containing folder is the python path.
Interestingly, there seems to be no libpython.dll in the anaconda3 dir. Perhaps it shall go under a different name?
I think I have read about some conda.dll or libconda.dll, maybe you could try that.
Hello rolf,
recently we have been facing the same issue. We realized that OpenTAP is not able to recognize Python 3.13. we installed python 3.12 and OpenTAP was able to recognize that.
Hope this helps.
Regards
Bharath