acoustic-carpenter-78188
03/21/2023, 5:01 PMfrom flytekit import task, workflow
@task
def t1(x: int) -> int:
return x + 1
@task
def t2(x: str) -> str:
return str(x)
@workflow
def wf(x: int) -> str:
out1 = t1(x=x)
return t2(x=out1)
if __name__ == "__main__":
print(wf(x=5))
The error:
File "/Users/nielsbantilan/git/flytekit/flytekit/core/type_engine.py", line 185, in to_python_value
raise TypeTransformerFailedError(f"Cannot convert literal {lv} to {self._type}")
flytekit.core.type_engine.TypeTransformerFailedError: Cannot convert literal scalar {
primitive {
integer: 6
}
}
to <class 'str'>
Goal: What should the final outcome look like, ideally?
When there's a type mismatch error, identify where exactly in the workflow it's happening:
• the task where the conversion failed
• the input that fails conversion
Describe alternatives you've considered
NA
Propose: Link/Inline OR Additional context
No response
Are you sure this issue hasn't been raised already?
☑︎ Yes
Have you read the Code of Conduct?
☑︎ Yes
flyteorg/flyte