ccxt: TCPConnector loop unexpected keyword argument, aiohttp 4.0.0a1 vs 3.6.2

Environment: ccxt Docker Image Exchange: Bitbns (New exchange I’m working on)

All my tests except for python3 were passing with only these logs

root@553fab6a317d:/ccxt# node run-tests.js 
Testing { exchanges: ["bitbns"], symbol: "all", keys: { '--js': false, '--php': false, '--python': false, '--python2': false, '--python3': false }, maxConcurrency: 5 } (run-tests.js:252)
[100%] Testing bitbns FAIL (testExchange @ run-tests.js:169)

FAILED bitbns (Python 3): (explain @ run-tests.js:187)

	bitbns using proxy `` (explain @ run-tests.js:190)

I could not get any idea from above, so after a little digging, I realised I’ll have to run the probably python3 python/tests/test_async.py. On running it I got this output, please have a look.

root@553fab6a317d:/ccxt# python3 python/test/test_async.py 
bitbns using proxy ``
<class 'TypeError'> __init__() got an unexpected keyword argument 'loop' 

  File "python/test/test_async.py", line 448, in <module>
    asyncio.get_event_loop().run_until_complete(main())

  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()

  File "python/test/test_async.py", line 442, in main
    await try_all_proxies(exchange, proxies)

  File "python/test/test_async.py", line 373, in try_all_proxies
    await load_exchange(exchange)

  File "python/test/test_async.py", line 279, in load_exchange
    await exchange.load_markets()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 185, in load_markets
    markets = await self.fetch_markets(params)

  File "/ccxt/python/ccxt/async_support/bitbns.py", line 162, in fetch_markets
    data = await self.publicGetFetchMarkets()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 116, in fetch2
    return await self.fetch(request['url'], request['method'], request['headers'], request['body'])

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 129, in fetch
    self.open()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 81, in open
    connector = aiohttp.TCPConnector(ssl=context, loop=self.asyncio_loop)

<class 'TypeError'> __init__() got an unexpected keyword argument 'loop' 

  File "python/test/test_async.py", line 448, in <module>
    asyncio.get_event_loop().run_until_complete(main())

  File "/usr/lib/python3.6/asyncio/base_events.py", line 484, in run_until_complete
    return future.result()

  File "python/test/test_async.py", line 442, in main
    await try_all_proxies(exchange, proxies)

  File "python/test/test_async.py", line 373, in try_all_proxies
    await load_exchange(exchange)

  File "python/test/test_async.py", line 279, in load_exchange
    await exchange.load_markets()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 185, in load_markets
    markets = await self.fetch_markets(params)

  File "/ccxt/python/ccxt/async_support/bitbns.py", line 162, in fetch_markets
    data = await self.publicGetFetchMarkets()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 116, in fetch2
    return await self.fetch(request['url'], request['method'], request['headers'], request['body'])

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 129, in fetch
    self.open()

  File "/ccxt/python/ccxt/async_support/base/exchange.py", line 81, in open
    connector = aiohttp.TCPConnector(ssl=context, loop=self.asyncio_loop)

root@553fab6a317d:/ccxt# 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@kroitor oh yes!! ive managed to already! probably cos its python3 V<= 3.5

Thank you so very much @kroitor

@kroitor oh! i think i may have found the problem… i was using python3.5… maybe not compatible. Hang on please!

@malcolm1232 If you rebuild the docker image, you should get the appropriate version of aiohttp.

@abhishekr700 ok, I’ve reproduced the issue with aiohttp 4.0.0a1 and fixed it in my local repo, however, with that version of aiohttp there’s another warning that happens inside the code of aiohttp, as reported here: https://github.com/aio-libs/aiohttp/issues/4282#issuecomment-549032887.

I believe, this is caused by the differences introduced in latest aiohttp 4.0.0a1 compared to 3.6.x. So, most of these issues are caused by the alpha-version of aiohttp. I would suggest to downgrade back to a more stable 3.6.x, until aiohttp releases a beta or a stable 4.x.x branch. We will force the version by specifying it in the dockerfile/setup.py till then. What do you say?

@abhishekr700 i’ll test with aiohttp==4.0.0a1 and will get back to you on this shortly.

@kroitor My version is aiohttp==4.0.0a1 Yup the sync version works and passes. Also, pip3 search aiohttp gives this

aiohttp (3.6.2)                        - Async http client/server framework (asyncio)
  INSTALLED: 4.0.0a1
  LATEST:    3.6.2
aiohttp-sse-client (0.1.6)             - A Server-Sent Event python client base on aiohttp