Giter VIP home page Giter VIP logo

Comments (5)

gringorichards avatar gringorichards commented on June 3, 2024 1

If it's juypter notebook in ananconda, then put these lines at the top to fix that.

import nest_asyncio
nest_asyncio.apply()

from understat.

hayilmaz avatar hayilmaz commented on June 3, 2024

ran the following code:

async def main():
async with aiohttp.ClientSession() as session:
understat = Understat(session)
player = await understat.get_league_players(
"epl", 2018,
player_name="Paul Pogba",
team_title="Manchester United"
)
print(json.dumps(player))

loop = asyncio.get_event_loop()
loop.run_until_complete(main())

got the following message:

RuntimeError Traceback (most recent call last)
in
10
11 loop = asyncio.get_event_loop()
---> 12 loop.run_until_complete(main())

~/anaconda3/lib/python3.7/asyncio/base_events.py in run_until_complete(self, future)
569 future.add_done_callback(_run_until_complete_cb)
570 try:
--> 571 self.run_forever()
572 except:
573 if new_task and future.done() and not future.cancelled():

~/anaconda3/lib/python3.7/asyncio/base_events.py in run_forever(self)
524 self._check_closed()
525 if self.is_running():
--> 526 raise RuntimeError('This event loop is already running')
527 if events._get_running_loop() is not None:
528 raise RuntimeError(

RuntimeError: This event loop is already running

[{"id": "1740", "player_name": "Paul Pogba", "games": "35", "time": "3013", "goals": "13", "xG": "15.87753972876817", "assists": "9", "xA": "5.186745170503855", "shots": "105", "key_passes": "55", "yellow_cards": "6", "red_cards": "0", "position": "M S", "team_title": "Manchester United", "npg": "6", "npxG": "8.265851370058954", "xGChain": "21.12592289596796", "xGBuildup": "11.593518570065498"}]

from understat.

amosbastian avatar amosbastian commented on June 3, 2024

Did you figure it out?

from understat.

hayilmaz avatar hayilmaz commented on June 3, 2024

from understat.

hayilmaz avatar hayilmaz commented on June 3, 2024

from understat.

Related Issues (16)

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.