Net Sim
Net Sim

Reputation: 357

Groovy does not receive Map from python script correctly

I am using jenkins pipeline to receive data ( Map ) from Python script 3.x

In Python :

return MAP ( dict() )

Jenkins pipeline ( groovy ) :

def var= bat(script: "python D:\\getData.py", returnStdout: true)

but var will be null

I believe that python function return data because i tried to use print instead of return in Terminal

and needed data retrieves correctly in terminal How to solve that problem ?

Upvotes: 0

Views: 425

Answers (1)

daggett
daggett

Reputation: 28634

https://jenkins.io/doc/pipeline/steps/workflow-durable-task-step/#-bat-%20windows%20batch%20script

bat returns or status code or stdout as text.

There is no other way to pass data as a string.

So, you could print out your map as json, and in groovy parse it.

Upvotes: 2

Related Questions