Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Spider arguments sent using Scrapyd #78

Closed
dfockler opened this issue Jan 15, 2015 · 6 comments
Closed

Error with Spider arguments sent using Scrapyd #78

dfockler opened this issue Jan 15, 2015 · 6 comments

Comments

@dfockler
Copy link
Contributor

I figured out the solution to this, but I thought I would put it somewhere for comment and documentation.
I was getting this error when scheduling spider runs through scrapyd with spider arguments.

    TypeError: __init__() got an unexpected keyword argument '_job'

It's not stated in the documentation explicitly, but when using scrapyd your spiders should allow for any number of arguments which I did not realize. scrapyd was sending a _job keyword to the spider, which my spider couldn't handle. So in short your spider __init__ def should look like

    def __init__(self, *args, **kwargs):

and look for the keyword of the argument you want instead of

    def __init__(self, my_keyword="default"):

Hopefully this helps some other python newbies in the future.

@jayzeng
Copy link
Contributor

jayzeng commented Jan 15, 2015

@dfockler thanks for sharing, mind sending in a PR to update the docs? (https://github.com/scrapy/scrapyd/tree/master/docs)

@emilepetrone
Copy link

@dfockler ditto, thanks for sharing. Saved me!

@wangzhen11aaa
Copy link

wangzhen11aaa commented Mar 30, 2018

thanks.@dfockler

@sept44
Copy link

sept44 commented Apr 25, 2019

hi,friends.
i meet a question,i use scrapy-redis,when I run my code,I was getting this error when scheduling spider runs through scrapyd with spider arguments.look:

  File "D:\swipers\snowball_spider\.env\lib\site-packages\scrapy_redis\pipelines.py", line 54, in from_settings
    return cls(**params)
TypeError: __init__() got an unexpected keyword argument 'server'

I thought for a long time, I thought it was a version conflict of redis at first, but I changed a lot of redis versions, or not, my scrapy-redis is 0.6.8, I need your help. Thank you.

@Digenis
Copy link
Member

Digenis commented Apr 26, 2019

@re0phimes
Copy link

saved my ass!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants