What is causing workflows to fail at the Python step?

This topic was automatically generated from Slack. You can find the original thread here.

Some of my workflows are failing at the Python step. The workflow was running properly till yesterday, can someone help identify the issue?

Hello , could you share more detail about your python code step?

Maybe @U02SX7ETBFB can help with your issue when he comes online!

Sure!

Attaching a screenshot for reference, I am only using Python to output a date.

Hi can you share the actual python code itself so we can reproduce?

Not a screenshot, but the text

Here you go-

import pendulum

def handler():
  now = pendulum.now("Asia/Calcutta")

  if now.hour>=20:
    date= pendulum.tomorrow("Asia/Calcutta")
    sdate= [date.at](http://date.at)(20)
    edate= [date.at](http://date.at)(21)
  else:
    sdate=[now.at](http://now.at)(20)
    edate=[now.at](http://now.at)(21)

  return {"sdate": sdate.to_iso8601_string(), "edate":edate.to_iso8601_string()}
 

Thank you, much appreciated

It’s quite weird that I couldn’t reproduce it

Yes, this is what we are wondering too.
The code is correct, and was running till yesterday. Not sure what has happened here

Seeing the same.

In the original the pd argument is missing from the handler function. Once I added that it was able to run. Can you try adding the pd argument back ?

import pendulum

def handler(pd):
  now = pendulum.now("Asia/Calcutta")

  if now.hour>=20:
    date= pendulum.tomorrow("Asia/Calcutta")
    sdate= [date.at](http://date.at)(20)
    edate= [date.at](http://date.at)(21)
  else:
    sdate=[now.at](http://now.at)(20)
    edate=[now.at](http://now.at)(21)

  return {"sdate": sdate.to_iso8601_string(), "edate":edate.to_iso8601_string()}

I think this may be another case of this known bug: [BUG] ECONNRESET error on python code steps · Issue #5086 · PipedreamHQ/pipedream · GitHub

I notice this happens in a workflow with pre existing steps.
It does not happen on a brand new workflow with only one python step.