Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Jython not returning Data Source value

reactancexl
reactancexl Posts: 152

I am using soavirt 2020.2 version. I am trying to use extensibility tool to get a value from writable datasource and get the error below. I tried convert to string and still the same. Assuming there is a convert to unicode in Jython but could not find anything. Any help appreciated. I eventually want to get current time in this script and then subtract the start value below which happens earlier in my scenario, but need this resolved first. thx

AttributeError: 'unicode' object has no attribute 'getValue'

from soaptest.api import *
from com.parasoft.api import *

def getWritableValue(context):
value = context.getValue("writable","start")
return value

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,074 ✭✭✭
    edited June 2021

    "unicode object" is referring to the value being a string, which has no "getValue" as stated by the error. In the Extension Tool, the first argument is the tool's input (a string) and the optional second argument is a com.parasoft.api.ScriptingContext.

    So, you want to change "def getWritableValue(context)" to "def getWritableValue(input, context)" instead.