CLI shows serialization error while Editor runs fine

This strange error happens when a python plugin step is added as a child step of any normal OpenTap step.
Then any parameter created from this normal OpenTap parent step to the test plan will cause XML serialization error thus makes this parameter not working.

As example below, the parameterization of Enable: <Enabled Parameter="Parameters \ Common \ Enabled">true</Enabled>, will cause the error showing in CLI, but not in Editor.

<?xml version="1.0" encoding="utf-8"?>
<TestPlan type="OpenTap.TestPlan" Locked="false">
  <Steps>
    <TestStep type="OpenTap.Plugins.BasicSteps.RepeatStep" Version="9.16.4+654f0b6b" Id="bc30814c-2f11-4cbd-b731-6f38cd3a6f1c">
      <Action>Fixed_Count</Action>
      <TargetStep />
      <TargetVerdict>Fail</TargetVerdict>
      <Count>3</Count>
      <Retry>false</Retry>
      <MaxCount>
        <Value>3</Value>
        <IsEnabled>false</IsEnabled>
      </MaxCount>
      <Enabled Parameter="Parameters \ Common \ Enabled">true</Enabled>
      <Name>Repeat</Name>
      <ChildTestSteps>
        <TestStep type="Python.PluginExample.EnumUsage" Id="ebcd32ec-48df-4d60-9a03-508d8a04be1e">
          <SelectedVerdict>Pass</SelectedVerdict>
          <LogEvent>Error</LogEvent>
          <InputImpedance>TenMegaOhm</InputImpedance>
          <ColorOne>RED</ColorOne>
          <ColorTwo>RED</ColorTwo>
          <ColorThree>RED</ColorThree>
          <ChildTestSteps />
          <Enabled>true</Enabled>
          <Name>Enum Usage</Name>
          <BreakConditions>Inherit</BreakConditions>
        </TestStep>
      </ChildTestSteps>
      <BreakConditions>Inherit</BreakConditions>
    </TestStep>
  </Steps>
  <BreakConditions>Inherit</BreakConditions>
  <OpenTap.Description />
  <Parameters_x0020__x005C__x0020_Common_x0020__x005C__x0020_Enabled>true</Parameters_x0020__x005C__x0020_Common_x0020__x005C__x0020_Enabled>
  <Package.Dependencies>
    <Package Name="OpenTAP" Version="9.16.4+654f0b6b" />
  </Package.Dependencies>
</TestPlan>```

Hi Mark,
I’ve run your test plan on my system and I am not seeing any errors. I’m currently using Python v3.7.8, OpenTAP 9.16.4, and Python plugin 2.3.1. I see the only potentially impactful difference is that your Python plugin version is not up-to-date. Try updating your plugin and see if that helps!


1 Like

@MarkLong we did make some pretty substantial updates to the Python plugin recently both from a feature and performance perspective, so I’d definitely recommend the latest.

Also, welcome to the OpenTAP Community!

Hi @brennen_direnzo and @ivan.diep , Thanks for the response!

I just updated everything to the newest version, but the issue still exist. I’m wondering what is the difference between your setup and mine. The only difference I can see I got slightly higher python version, but I believe that shouldn’t be the cause here.

I found some error message in the session log, not sure how relevant it is.
SessionLog 2022-01-26 11-34-07.txt (13.8 KB)

1 Like

@MarkLong it looks like you are running the CLI through the PowerShell interpreter. Can you try the standard Windows one as a test?

Also, for the Python version, we use an open source project called Python.NET (GitHub - pythonnet/pythonnet: Python for .NET is a package that gives Python programmers nearly seamless integration with the .NET Common Language Runtime (CLR) and provides a powerful application scripting tool for .NET developers.) to handle the connections between .NET and Python. Currently we are on version 2.5, which claims to only support up to Python version 3.8. However, given this works in the Editor, I think it’s unlikely to be the issue. But if you can’t get it working with the Windows Command Prompt, it may be worth downgrading to eliminate another variable.

I tried to run it in windows command line, downgrade python version to 3.7.8

Unfortunately it still shows the same issue… What else I can try? Reinstall OpenTap? Run it in VM?

It looks like there were a bunch of files that weren’t loaded:

2022-01-26 11:34:09.125474 ; Resolver       ; Debug       ;Unable to find match for OpenTap.__path__
2022-01-26 11:34:09.133474 ; Resolver       ; Debug       ; Unable to find match for OpenTap.__spec__
2022-01-26 11:34:09.140467 ; Resolver       ; Debug       ; Unable to find match for OpenTap.Enabled
2022-01-26 11:34:09.144467 ; Resolver       ; Debug       ; Unable to find match for OpenTap.Input
2022-01-26 11:34:09.148467 ; Resolver       ; Debug       ; Unable to find match for OpenTap.ScalarResultSink
2022-01-26 11:34:09.153474 ; Resolver       ; Debug       ; Unable to find match for OpenTap.SessionLocal
2022-01-26 11:34:09.246474 ; Resolver       ; Debug       ; Unable to find match for OpenTap.__all__
2022-01-26 11:34:09.249474 ; Resolver       ; Debug       ; Unable to find match for Keysight
2022-01-26 11:34:09.252474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap
2022-01-26 11:34:09.254474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap.Plugins
2022-01-26 11:34:09.256474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap.Plugins.Python.__spec__
2022-01-26 11:34:09.260474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap.Plugins.Python.__path__
2022-01-26 11:34:09.264474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap.Plugins.Python.PythonComponentSettingsWrapper
2022-01-26 11:34:09.284474 ; Resolver       ; Debug       ; Unable to find match for Keysight.OpenTap.Plugins.Python.__all__
2022-01-26 11:34:09.288474 ; Resolver       ; Debug       ; Unable to find match for Keysight.__path__
2022-01-26 11:34:09.295467 ; Resolver       ; Debug       ; Unable to find match for Keysight.Plugins
2022-01-26 11:34:09.298466 ; Resolver       ; Debug       ; Unable to find match for Keysight.Plugins.Python
2022-01-26 11:34:09.302467 ; Resolver       ; Debug       ; Unable to find match for Keysight.Plugins.Python.__all__
2022-01-26 11:34:09.330467 ; Resolver       ; Debug       ; Unable to find match for OpenTap.Cli.__all__
2022-01-26 11:34:09.336467 ; Resolver       ; Debug       ; Unable to find match for System.__path__
2022-01-26 11:34:09.340467 ; Resolver       ; Debug       ; Unable to find match for System.Collections.Generic
2022-01-26 11:34:09.343466 ; Resolver       ; Debug       ; Unable to find match for System.Collections.Generic.List
2022-01-26 11:34:09.348466 ; Resolver       ; Debug       ; Unable to find match for System.__spec__
2022-01-26 11:34:09.357467 ; Resolver       ; Debug       ; Unable to find match for System.Xml.__path__
2022-01-26 11:34:09.368467 ; Resolver       ; Debug       ; Unable to find match for System.ComponentModel.__spec__
2022-01-26 11:34:09.372467 ; Resolver       ; Debug       ; Unable to find match for System.ComponentModel.__path__
2022-01-26 11:34:09.427474 ; Resolver       ; Debug       ; Unable to find match for System.IO.__all__
2022-01-26 11:34:09.434474 ; Resolver       ; Debug       ; Unable to find match for System.Diagnostics
2022-01-26 11:34:09.437474 ; Resolver       ; Debug       ; Unable to find match for System.Diagnostics.__spec__
2022-01-26 11:34:09.441474 ; Resolver       ; Debug       ; Unable to find match for System.Diagnostics.__path__
2022-01-26 11:34:09.449474 ; Resolver       ; Debug       ; Unable to find match for Keysight.__spec__

From the log, it looks like you are using the working dircetory: C:\Users\Mark\evbox\OpenTAP

Can you try running in C:\Users\Mark\OpenTAP? Then your command becomes:

tap run python_error.TapPlan

Sorry for the confusion, I tried to run it in different environments, including windows, window vm and ubuntu. It all shows the same error message. Probably I upload the the session file from different environment.
I didn’t install OpenTap at the default location. Could that be a issue?

Here is a screenshot under ubuntu.

1 Like

I wouldn’t expect it to be, but given the issues you’ve seen it may be worth doing a clean install in the default location (reinstall the Python Plugin as well).

@rolf_madsen any other ideas here?