question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with asyncio

See original GitHub issue

There seems to be a lot of issues using asnycio class.

import ccxt.async as ccxt
gdax = ccxt.gdax()
print(asyncio.get_event_loop().run_until_complete(gdax.load_markets()))

Throws

ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f34fee189b0>

If i call fetch_balance() I get:

  File "uvloop/loop.pyx", line 1203, in uvloop.loop.Loop.run_until_complete (uvloop/loop.c:25632)
  File ".venv/lib/python3.6/site-packages/ccxt/async/exchanges.py", line 8516, in fetch_balance
    balances = await self.privateGetAccounts()
  File "venv/lib/python3.6/site-packages/ccxt/async/exchanges.py", line 8678, in request
    response = await self.fetch(url, method, headers, body)
  File ".venv/lib/python3.6/site-packages/ccxt/async/exchange.py", line 85, in fetch
    async with session_method(url, data=body or None, headers=headers, timeout=(self.timeout / 1000)) as response:
  File ".venv/lib/python3.6/site-packages/aiohttp/client.py", line 603, in __aenter__
    self._resp = yield from self._coro
  File ".venv/lib/python3.6/site-packages/aiohttp/client.py", line 239, in _request
    resp = req.send(conn)
  File ".venv/lib/python3.6/site-packages/aiohttp/client_reqrep.py", line 401, in send
    writer.write_headers(status_line, self.headers)
  File ".venv/lib/python3.6/site-packages/aiohttp/http_writer.py", line 250, in write_headers
    [k + SEP + v + END for k, v in headers.items()])
  File ".venv/lib/python3.6/site-packages/aiohttp/http_writer.py", line 250, in <listcomp>
    [k + SEP + v + END for k, v in headers.items()])
TypeError: must be str, not bytes

It 's not attached to GDAX . I am afraid that it is an overall issue. Good luck, hope that you can find the time.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:63 (37 by maintainers)

github_iconTop GitHub Comments

1reaction
artas728commented, Apr 26, 2020

@kroitor , I checked, it works correctly thank you!

1reaction
whewardcommented, Feb 25, 2018

@kroitor all good, works perfectly now, thanks again!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python asyncio issues - asynchronous - Stack Overflow
I have no idea what could be going on. There is no exception, and no data seems to be sent. import asyncio loop...
Read more >
Issues · python/asyncio - GitHub
Issues list ; Why asyncio.transport.write() function don`t send data until I use transport.close() or stop the event loop. #501 opened on Sep 28,...
Read more >
Developing with asyncio — Python 3.11.1 documentation
Asynchronous programming is different from classic “sequential” programming. This page lists common mistakes and traps and explains how to avoid them.
Read more >
How to Avoid Issues When Waiting On Multiple Events in ...
Asyncio is a powerful way to implement multitasking in Python but failing to use it properly can lead to poor code performance.
Read more >
Solve a batch of problems using asyncio - Azure Quantum
To submit a batch of problems and run other processing steps while waiting for them to finish, one option would be to use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found