estin / pomp

Screen scraping and web crawling framework
https://pomp.readthedocs.org
Other
60 stars 10 forks source link

'PhantomDownloader' object has no attribute 'drivers' #8

Open karambaq opened 6 years ago

karambaq commented 6 years ago

Just trying to launch e05_phantomjs.py example.

INFO:pomp.engine:Prepare downloader: <__main__.PhantomDownloader object at 0x10e0be3c8> INFO:pomp.engine:Start crawler: <__main__.TwitterSpider object at 0x10e78c128> INFO:pomp.engine:Start pipe: <e02_quotes.PrintPipeline object at 0x10e77ff60> Traceback (most recent call last): File "e05_phantomjs.py", line 200, in <module> pomp.pump(TwitterSpider()) File "/usr/local/lib/python3.6/site-packages/pomp/core/engine.py", line 271, in pump iterator(next_requests), crawler, File "/usr/local/lib/python3.6/site-packages/pomp/core/engine.py", line 158, in process_requests self._req_middlewares(requests, crawler), crawler): File "e05_phantomjs.py", line 109, in process request.driver_url = self.drivers[0].command_executor._url AttributeError: 'PhantomDownloader' object has no attribute 'drivers'

estin commented 6 years ago

I don't know what is going on...

Where is my attempt

$ git clone https://github.com/estin/pomp
$ cd pomp
# isolate environment via awesome pipenv
$ pipenv install .
$ pipenv shell
$ pip install futures lxml selenium
$ python setup.py develop

And run phantomjs example

$ python examples/e05_phantomjs.py
...skipped...
---------------------------------------------------------------------------
Pycoders Weekly likes: 2
body: Pycoders Weekly (Issue #305): Cogent -http://mailchi.mp/pycoders/pycoders-weekly-issue-263-source-209833 …
---------------------------------------------------------------------------
Pycoders Weekly likes: 5
body: Which Python course is teaching you how to work with large amount of data? –http://bit.ly/2FUreCM 
---------------------------------------------------------------------------
Pycoders Weekly likes: 5
body: Guido van Rossum: BDFL Python 3 retrospective –http://bit.ly/2FVHCTH 
DEBUG:__main__:close all phantomjs nodes
INFO:pomp.engine:Stop pipe: <e02_quotes.PrintPipeline object at 0x7f2e347995c0>
INFO:pomp.engine:Stop crawler: <__main__.TwitterSpider object at 0x7f2e34799748>
Statistics:
 requests/responses/exceptions = 8/8/0

Where my versions are

$ python --version
Python 3.6.4

$ phantomjs --version
2.1.1

$ pip freeze
futures==3.1.1
lxml==4.2.1
-e git+https://github.com/estin/pomp@ce0cca94c17a62da592fe90962f103a425e817c3#egg=pomp
selenium==3.11.0

Can you gather more info about it?

estin commented 6 years ago

Oh... I see pomp on 0.2.1 has this issue.

$ pip freeze
futures==3.1.1
lxml==4.2.1
pomp==0.2.1
selenium==3.11.0

$ python examples/e05_phantomjs.py
INFO:pomp.engine:Prepare downloader: <__main__.PhantomDownloader object at 0x7fda86c12860>
INFO:pomp.engine:Start crawler: <__main__.TwitterSpider object at 0x7fda85b78438>
INFO:pomp.engine:Start pipe: <e02_quotes.PrintPipeline object at 0x7fda85b782b0>
Traceback (most recent call last):
  File "examples/e05_phantomjs.py", line 200, in <module>
    pomp.pump(TwitterSpider())
  File "/home/user/.local/share/virtualenvs/tmp-XVr6zr33/lib/python3.6/site-packages/pomp/core/engine.py", line 271, in pump
    iterator(next_requests), crawler,
  File "/home/user/.local/share/virtualenvs/tmp-XVr6zr33/lib/python3.6/site-packages/pomp/core/engine.py", line 158, in process_requests
    self._req_middlewares(requests, crawler), crawler):
  File "examples/e05_phantomjs.py", line 109, in process
    request.driver_url = self.drivers[0].command_executor._url
AttributeError: 'PhantomDownloader' object has no attribute 'drivers'

You can try to upgrade pomp from this repo

$ pip install -U git+https://github.com/estin/pomp@ce0cca94c17a62da592fe90962f103a425e817c3#egg=pomp

I do't know when I can find some time to prepare Pomp for releasing to pypi.