-1

Hi I am trying to use schedule but it returns the first argument must be callable. I tried looking into other where they say, I must not use the parentheses. However if I do not use the parentheses how would I pass the var?

It looks like this

schedule.every().day.at("13:42").do(scrape("www.website.com"))

where scrape is a function define as

def scrape(URL):
    items = scrapeModule1(URL)
    return items

If I take out the URL what or how am I supposed to call out the var in the def function?

  • 1
    You could hardcore the URL in the function or just pass a `lambda: scrape(...)` as the function. – luk2302 Mar 25 '22 at 07:01
  • 1
    `do(scrape, "www.website.com")`. See [duplicate](https://stackoverflow.com/q/26583557/3890632). – khelwood Mar 25 '22 at 07:05

1 Answers1

0

Without any knowledge of the framework you are using or the error you get:

schedule.every().day.at("13:42").do(lambda : scrape("www.website.com"))
gnight
  • 429
  • 2
  • 10
  • using beautiful soup python. it's all python modules. It works. Can I know what is lambda and what does it do exactly? – Halim Iskandar Mar 25 '22 at 07:05
  • Let me Google that for you: https://www.w3schools.com/python/python_lambda.asp . A lambda is a callable without a name – gnight Mar 25 '22 at 08:48