Giter Club home page Giter Club logo

Comments (5)

endafarrell avatar endafarrell commented on May 15, 2024

Similar for python 3.5:

python sciencenet_spider.py
[2018:04:14 22:32:58] Spider started!
[2018:04:14 22:32:58] Using selector: KqueueSelector
[2018:04:14 22:32:58] Base url: http://blog.sciencenet.cn/
[2018:04:14 22:32:58] Item "Post": 0
[2018:04:14 22:32:58] Requests count: 0
[2018:04:14 22:32:58] Error count: 0
[2018:04:14 22:32:58] Time usage: 0:00:00.001171
[2018:04:14 22:32:58] Spider finished!
Traceback (most recent call last):
  File "sciencenet_spider.py", line 19, in <module>
    MySpider.run()
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/site-packages/gain/spider.py", line 52, in run
    loop.run_until_complete(cls.init_parse(semaphore))
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/asyncio/futures.py", line 294, in result
    raise self._exception
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/asyncio/tasks.py", line 240, in _step
    result = coro.send(None)
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/site-packages/gain/spider.py", line 71, in init_parse
    with aiohttp.ClientSession() as session:
  File "/Users/endafarrell/anaconda/anaconda3/envs/py35/lib/python3.5/site-packages/aiohttp/client.py", line 746, in __enter__
    raise TypeError("Use async with instead")
TypeError: Use async with instead
sys:1: RuntimeWarning: coroutine 'Parser.task' was never awaited
[2018:04:14 22:32:58] Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x107259e48>

When python is:

python
Python 3.5.5 |Anaconda, Inc.| (default, Mar 12 2018, 16:25:05)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin

from gain.

solarhell avatar solarhell commented on May 15, 2024

Check this line 2c8160c#diff-6b9bdc895398e257e454fa60948dba08R69
Just clone the latest code...
It seems that author didn't release the latest version to pypi @gaojiuli

from gain.

endafarrell avatar endafarrell commented on May 15, 2024

Hi @solarhell - many thanks. After I clone'd the latest code (and then added my local-subdir gain to the sys.path), the example works.

@gaojiuli - I'd love to know when pypi is updated!

from gain.

chenlei9907 avatar chenlei9907 commented on May 15, 2024

same issue in python3.6

[2019:01:30 10:04:19] Spider started!
[2019:01:30 10:04:19] Base url: http://blog.sciencenet.cn/
[2019:01:30 10:04:19] Item "Post": 0
[2019:01:30 10:04:19] Requests count: 0
[2019:01:30 10:04:19] Error count: 0
[2019:01:30 10:04:19] Time usage: 0:00:00.000988
[2019:01:30 10:04:19] Spider finished!
Traceback (most recent call last):
File "sciencenet_spider.py", line 19, in
MySpider.run()
File "/Users/leichen/anaconda3/lib/python3.6/site-packages/gain/spider.py", line 52, in run
loop.run_until_complete(cls.init_parse(semaphore))
File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
File "/Users/leichen/anaconda3/lib/python3.6/site-packages/gain/spider.py", line 71, in init_parse
with aiohttp.ClientSession() as session:
File "/Users/leichen/anaconda3/lib/python3.6/site-packages/aiohttp/client.py", line 956, in enter
raise TypeError("Use async with instead")
TypeError: Use async with instead
[2019:01:30 10:04:19] Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x111d2e940>
sys:1: RuntimeWarning: coroutine 'Parser.task' was never awaited

OS: Mac Darwin Kernel Version 18.2.0
Python Python 3.6.3 :: Anaconda custom (64-bit)
install gain via pip install gain

AnyIdea ?

from gain.

rdidyk avatar rdidyk commented on May 15, 2024

Just install it via pip install -U -e git+https://github.com/gaojiuli/gain.git#egg=gain

from gain.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.