opentap / OpenTap.Python

Python integration for OpenTAP
Apache License 2.0
22 stars 7 forks source link

Error importing 'opentap' when running isolated #87

Open alnlarsen opened 1 year ago

alnlarsen commented 1 year ago

Try the following command: ./tap image install "REST-API:2.10.1,Python:3.0.1"

This should give you a log like:

Modifying installation in C:\Users\allarsen\sandbox:
- Skipping OpenTAP version 9.19.4+7959a308 (x64-Windows) - Already installed.
- Installing Keysight Licensing version 1.3.0+5ca24fcb
- Installing Python version 3.0.1-beta.5+35ca0e40
- Installing REST-API version 2.10.1+16d14e72
Package Keysight Licensing exists in cache: C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\Keysight Licensing.1.3.0+5ca24fcb.x64.TapPackage
Package REST-API exists in cache: C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\REST-API.2.10.1+16d14e72.Windows,Linux,Macos.TapPackage
Installing C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\Keysight Licensing.1.3.0+5ca24fcb.x64.TapPackage
Installed Keysight Licensing version 1.3.0+5ca24fcb [108 ms]
Installing C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\Python.3.0.1-beta.5+35ca0e40.Windows,Linux,MacOS.TapPackage
Installed Python version 3.0.1-beta.5+35ca0e40 [15.7 ms]
Package 'Python' contains possibly relevant plugins for next package installations. Searching for plugins.. [16.2 ms]
Installing C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\REST-API.2.10.1+16d14e72.Windows,Linux,Macos.TapPackage
Starting install step 'tap remote configfile'
at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.NewReferenceExtensions.BorrowOrThrow(NewReference& reference)
   at Python.Runtime.PyModule.Import(String name)
   at OpenTap.Python.PythonInitializer.InitInternal() in C:\No module named 'opentap'
Users\allarsen\repos\OpenTap.Python\OpenTap.Python\PythonInitializer.cs:line 104
Updates available for:
 - Keysight Licensing: 1.3.0+5ca24fcb -> 1.3.1+32de61e1
 - Python: 3.0.1-beta.5+35ca0e40 -> 3.0.1+6a8e309f
Config file at C:\Users\allarsen\sandbox\Config\RPCBase.yaml already exists [95.0 ms]
Succesfully ran install step  'tap remote configfile'.  [52.7 s]
Package action OpenTap.Python.PythonInstallAction failed [2.04 s]
- Package failed to install: REST-API version 2.10.1+16d14e72 (C:\Users\allarsen\AppData\Local\OpenTap\PackageCache\REST-API.2.10.1+16d14e72.Windows,Linux,Macos.TapPackage)
- Failed to install packages
Image deployment failed to install packages.

Notably, the exception:

at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.NewReferenceExtensions.BorrowOrThrow(NewReference& reference)
   at Python.Runtime.PyModule.Import(String name)
   at OpenTap.Python.PythonInitializer.InitInternal() in C:\No module named 'opentap'

This only happens when running isolated. It happens on both Windows and Linux.

Note that it doesn't happen if Python plugin doesn't detect any Python installations.