Hi i can't start my bot discord
root#boot:~/mdrk/discord.py# python3.5 discordbot.py
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/aiohttp/connector.py", line 601, in _create_direct_connection
local_addr=self._local_addr)
File "/usr/local/lib/python3.5/asyncio/base_events.py", line 695, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.5/asyncio/base_events.py", line 682, in create_connection
yield from self.sock_connect(sock, address)
File "/usr/local/lib/python3.5/asyncio/futures.py", line 361, in __iter__
yield self # This tells Task to wait for completion.
File "/usr/local/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
future.result()
File "/usr/local/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/local/lib/python3.5/asyncio/selector_events.py", line 439, in _sock_connect_cb
raise OSError(err, 'Connect call failed %s' % (address,))
OSError: [Errno 113] Connect call failed ('104.16.59.5', 443)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/site-packages/aiohttp/connector.py", line 304, in connect
yield from self._create_connection(req)
File "/usr/local/lib/python3.5/site-packages/aiohttp/connector.py", line 578, in _create_connection
transport, proto = yield from self._create_direct_connection(req)
File "/usr/local/lib/python3.5/site-packages/aiohttp/connector.py", line 624, in _create_direct_connection
(req.host, req.port, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 113] Can not connect to discordapp.com:443 [Connect call failed ('104.16.59.5', 443)]
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "discordbot.py", line 121, in <module>
client.run('token')
File "/root/mdrk/discord.py/discord/client.py", line 518, in run
self.loop.run_until_complete(self.start(*args, **kwargs))
File "/usr/local/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete
return future.result()
File "/usr/local/lib/python3.5/asyncio/futures.py", line 274, in result
raise self._exception
File "/usr/local/lib/python3.5/asyncio/tasks.py", line 241, in _step
result = coro.throw(exc)
File "/root/mdrk/discord.py/discord/client.py", line 489, in start
yield from self.login(*args, **kwargs)
File "/root/mdrk/discord.py/discord/client.py", line 416, in login
yield from getattr(self, '_login_' + str(n))(*args, **kwargs)
File "/root/mdrk/discord.py/discord/client.py", line 346, in _login_1
data = yield from self.http.static_login(token, bot=is_bot)
File "/root/mdrk/discord.py/discord/http.py", line 258, in static_login
data = yield from self.request(Route('GET', '/users/#me'))
File "/root/mdrk/discord.py/discord/http.py", line 137, in request
r = yield from self.session.request(method, url, **kwargs)
File "/usr/local/lib/python3.5/site-packages/aiohttp/client.py", line 555, in __iter__
resp = yield from self._coro
File "/usr/local/lib/python3.5/site-packages/aiohttp/client.py", line 198, in _request
conn = yield from self._connector.connect(req)
File "/usr/local/lib/python3.5/site-packages/aiohttp/connector.py", line 314, in connect
.format(key, exc.strerror)) from exc
aiohttp.errors.ClientOSError: [Errno 113] Cannot connect to host discordapp.com:443 ssl:True [Can not connect to discordapp.com:443 [Connect call failed ('104.16.59.5', 443)]]
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f21a06dae48>
I need you help
This is an educational open source project with many sub-projects. The one I am studying currently is the 'crawler' project. It requires python 3.4+ and aiohttp 1.2+. My current setup is Windows 10, Python 3.6.1, and aiohttp 2.0.4.
Strangely, my tests do not run and it is related to aiohttp. Can anybody familiar with aiohttp tell me why?
Here is the output I get:
Related
I am writing a telegram bot on the aiogram framework. Everything was good when I run it, but today I am getting error,Cannot connect to host api.telegram.org:443 ssl:default I do not know what's problem.
I am using Ubuntu 20.04.2 LTS
Here is the full error
Traceback (most recent call last):
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/connector.py", line 1154, in _create_direct_connection
hosts = await asyncio.shield(host_resolved)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/connector.py", line 880, in _resolve_host
addrs = await self._resolver.resolve(host, port, family=self._family)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/resolver.py", line 33, in resolve
infos = await self._loop.getaddrinfo(
File "/usr/lib/python3.8/asyncio/base_events.py", line 825, in getaddrinfo
return await self.run_in_executor(
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -3] Temporary failure in name resolution
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/bot/api.py", line 139, in make_request
async with session.post(url, data=req, **kwargs) as response:
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/client.py", line 1138, in __aenter__
self._resp = await self._coro
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiohttp/connector.py", line 1166, in _create_direct_connection
raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Temporary failure in name resolution]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "app.py", line 18, in <module>
executor.start_polling(dp, on_startup=on_startup)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 45, in start_polling
executor.start_polling(
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 320, in start_polling
loop.run_until_complete(self._startup_polling())
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 372, in _startup_polling
await self._welcome()
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/utils/executor.py", line 361, in _welcome
user = await self.dispatcher.bot.me
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/bot/bot.py", line 30, in me
setattr(self, '_me', await self.get_me())
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/bot/bot.py", line 228, in get_me
result = await self.request(api.Methods.GET_ME, payload)
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/bot/base.py", line 231, in request
return await api.make_request(await self.get_session(), self.server, self.__token, method, data, files,
File "/home/mirodil/.local/share/virtualenvs/allinone-kbyzCwMv/lib/python3.8/site-packages/aiogram/bot/api.py", line 142, in make_request
raise exceptions.NetworkError(f"aiohttp client throws an error: {e.__class__.__name__}: {e}")
aiogram.utils.exceptions.NetworkError: Aiohttp client throws an error: ClientConnectorError: Cannot connect to host api.telegram.org:443 ssl:default [Temporary failure in name resolution]
Your base url should be https://api.telegram.org/, with that being said it is common to see ConnectionError and ReadTimeout during polling.
But, looking at the error socket.gaierror: [Errno -3] Temporary failure in name resolution there is an issue in getting the address info for the host. I'd start with ruling out any connection issues and then check your /etc/hosts file to see if there are any misconfigurations.
If neither works, try polling the API directly to see if the problem still exists.
FYI: Here is how I'm polling the API directly without any framework and never had a problem.
https://github.com/thevickypedia/Jarvis/blob/master/modules/telegram/bot.py
I use ubuntu 20.04 in AWS.
I have created a python asyio webapp.
I use Nginx.
The Nginx default page could load successfully.
However, after deploying my webapp, error occurs:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 503, in _connect
await self._request_authentication()
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 796, in _request_authentication
await self._process_auth(plugin_name, auth_packet)
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 819, in _process_auth
await self.sha256_password_auth(auth_packet)
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 970, in sha256_password_auth
pkt = await self._read_packet()
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 593, in _read_packet
packet.check_error()
File "/usr/local/lib/python3.8/dist-packages/pymysql/protocol.py", line 220, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python3.8/dist-packages/pymysql/err.py", line 109, in raise_mysql_exception
raise errorclass(errno, errval)
pymysql.err.OperationalError: (1045, "Access denied for user 'www'#'localhost' (using password: YES)")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "app.py", line 154, in <module>
loop.run_until_complete(init(loop))
File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "app.py", line 142, in init
yield from orm.create_pool(loop=loop, **configs.db)
File "/home/ubuntu/srv/awesome/www/orm.py", line 17, in create_pool
__pool = yield from aiomysql.create_pool(
File "/usr/local/lib/python3.8/dist-packages/aiomysql/pool.py", line 29, in _create_pool
await pool._fill_free_pool(False)
File "/usr/local/lib/python3.8/dist-packages/aiomysql/pool.py", line 167, in _fill_free_pool
conn = await connect(echo=self._echo, loop=self._loop,
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 75, in _connect
await conn._connect()
File "/usr/local/lib/python3.8/dist-packages/aiomysql/connection.py", line 521, in _connect
raise OperationalError(2003,
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1'")
How to fix my problem?
Found an interesting piece of code, on gist.github.
It works great, if the remote network is responding fast enough, with the default "timeout=0.1". however, in real live application, this often needs to be raised. Particularly, when scanning the network range, this script shoots out the error, with timeout as low as 0.2, almost each time.
Looking at the code, seems that the script is supposed to ignore such errors, but it, actually, instantly quits working.
except (asyncio.TimeoutError, ConnectionRefusedError):
pass
else:
yield task # yield successful tasks
Here's the full error I get:
unhandled exception during asyncio.run() shutdown
task: <Task finished coro=<<async_generator_athrow without __name__>()> exception=RuntimeError("can't send non-None value to a just-started coroutine")>
Traceback (most recent call last):
File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "port.py", line 130, in main
async for task in streamer:
File "/usr/local/lib/python3.7/site-packages/aiostream/stream/advanced.py", line 43, in base_combine
result = getter()
File "port.py", line 79, in task_worker
await asyncio.wait_for(conn, task.timeout)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/asyncio/streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 959, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 946, in create_connection
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 464, in sock_connect
return await fut
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 494, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('184.183.182.181', 8001)
During handling of the above exception, another exception occurred:
RuntimeError: can't send non-None value to a just-started coroutine
Traceback (most recent call last):
File "port.py", line 153, in <module>
asyncio.run(main(sys.argv[1], ''.join(sys.argv[2:])))
File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
return future.result()
File "port.py", line 130, in main
async for task in streamer:
File "/usr/local/lib/python3.7/site-packages/aiostream/stream/advanced.py", line 43, in base_combine
result = getter()
File "port.py", line 79, in task_worker
await asyncio.wait_for(conn, task.timeout)
File "/usr/local/lib/python3.7/asyncio/tasks.py", line 416, in wait_for
return fut.result()
File "/usr/local/lib/python3.7/asyncio/streams.py", line 77, in open_connection
lambda: protocol, host, port, **kwds)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 959, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 946, in create_connection
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 464, in sock_connect
return await fut
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 494, in _sock_connect_cb
raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('184.183.182.181', 8001)
The goal is to ignore the error and to complete the loop.
Any input appreciated.
I have two python scripts, currentdataupload.py and productioncount.py on my Ubuntu server. currentdataupload.py uploads dummy current data and productioncount.py accesses that data to do some calculations. The code runs perfectly in other scenarios without disrupting the MongoDB, but when I run both of these codes simultaneously using nohup after a few seconds it exits the mongoDB service and is no longer able to upload or retrieve data. I would like to know if I am doing the entire process the right way or I am messing up somewhere big time.
Error log
Traceback (most recent call last):
File "/python_codes/currentdataupload.py", line 38, in <module>
result = posts.insert_one(post_data)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/collection.py", line 630, in insert_one
bypass_doc_val=bypass_document_validation),
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/collection.py", line 535, in _insert
check_keys, manipulate, write_concern, op_id, bypass_doc_val)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/collection.py", line 516, in _insert_one
check_keys=check_keys)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 244, in command
self._raise_connection_failure(error)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 372, in _raise_connection_failure
raise error
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 239, in command
read_concern)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/network.py", line 96, in command
response = receive_message(sock, 1, request_id)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/network.py", line 123, in receive_message
header = _receive_data_on_socket(sock, 16)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/network.py", line 161, in _receive_data_on_socket
raise AutoReconnect("connection closed")
pymongo.errors.AutoReconnect: connection closed
Traceback (most recent call last):
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 543, in connect
sock = _configured_socket(self.address, self.opts)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 452, in _configured_socket
sock = _create_connection(address, options)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 436, in _create_connection
raise err
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 429, in _create_connection
sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/python_codes/productioncount.py", line 267, in <module>
result = col2.find_one({"date": date, "machine": machine})
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/collection.py", line 1014, in find_one
for result in cursor.limit(-1):
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/cursor.py", line 1090, in next
if len(self.__data) or self._refresh():
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/cursor.py", line 1012, in _refresh
self.__read_concern))
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/cursor.py", line 850, in __send_message
**kwargs)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/mongo_client.py", line 844, in _send_message_with_response
exhaust)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/mongo_client.py", line 855, in _reset_on_error
return func(*args, **kwargs)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/server.py", line 99, in send_message_with_response
with self.get_socket(all_credentials, exhaust) as sock_info:
File "/root/anaconda3/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/server.py", line 163, in get_socket
with self.pool.get_socket(all_credentials, checkout) as sock_info:
File "/root/anaconda3/lib/python3.5/contextlib.py", line 59, in __enter__
return next(self.gen)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 582, in get_socket
sock_info = self._get_socket_no_auth()
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 628, in _get_socket_no_auth
sock_info = self._check(sock_info)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 682, in _check
return self.connect()
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 555, in connect
_raise_connection_failure(self.address, error)
File "/root/anaconda3/lib/python3.5/site-packages/pymongo/pool.py", line 65, in _raise_connection_failure
raise AutoReconnect(msg)
pymongo.errors.AutoReconnect: localhost:27017: [Errno 111] Connection refused
MongoDB shouldn't crash. Please file a bug report, including the Python script you run and a complete MongoDB logfile, at jira.mongodb.org.
I'm trying to run the starter code for celery on their website (http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html), and I'm running an instance of a RabbitMQ server in the background. However, I'm getting a long error message:
>>> from celery import Celery
>>> app = Celery('tasks', broker='pyamqp://guest#localhost//')
>>> #app.task
... def add(x, y):
... return x + y
...
>>>
>>> add.delay(4, 4)
Traceback (most recent call last):
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 36, in __call__
return self.__value__
AttributeError: 'ChannelPromise' object has no attribute '__value__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 494, in _ensured
return fun(*args, **kwargs)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 187, in _publish
channel = self.channel
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 209, in _get_channel
channel = self._channel = channel()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 38, in __call__
value = self.__value__ = self.__contract__()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 224, in <lambda>
channel = ChannelPromise(lambda: connection.default_channel)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 819, in default_channel
self.connection
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
self._connection = self._establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
conn.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
self.transport.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
self.socket_settings, self.read_timeout, self.write_timeout,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
self._set_socket_options(socket_settings)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
self.sock.setsockopt(SOL_TCP, opt, val)
OSError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
yield
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 515, in _ensured
reraise_as_library_errors=False,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 405, in ensure_connection
callback)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 333, in retry_over_time
return fun(*args, **kwargs)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 261, in connect
return self.connection
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
self._connection = self._establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
conn.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
self.transport.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
self.socket_settings, self.read_timeout, self.write_timeout,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
self._set_socket_options(socket_settings)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
self.sock.setsockopt(SOL_TCP, opt, val)
OSError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\task.py", line 412, in delay
return self.apply_async(args, kwargs)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\task.py", line 535, in apply_async
**options
File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\base.py", line 737, in send_task
amqp.send_task_message(P, name, message, **options)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\celery\app\amqp.py", line 558, in send_task_message
**properties
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\messaging.py", line 181, in publish
exchange_name, declare,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 527, in _ensured
errback and errback(exc, 0)
File "C:\Users\Alexander\Anaconda3\lib\contextlib.py", line 77, in __exit__
self.gen.throw(type, value, traceback)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 419, in _reraise_as_library_errors
sys.exc_info()[2])
File "C:\Users\Alexander\Anaconda3\lib\site-packages\vine\five.py", line 175, in reraise
raise value.with_traceback(tb)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 414, in _reraise_as_library_errors
yield
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 515, in _ensured
reraise_as_library_errors=False,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 405, in ensure_connection
callback)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\utils\functional.py", line 333, in retry_over_time
return fun(*args, **kwargs)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 261, in connect
return self.connection
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 802, in connection
self._connection = self._establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\connection.py", line 757, in _establish_connection
conn = self.transport.establish_connection()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\kombu\transport\pyamqp.py", line 130, in establish_connection
conn.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\connection.py", line 294, in connect
self.transport.connect()
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 122, in connect
self.socket_settings, self.read_timeout, self.write_timeout,
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 174, in _init_socket
self._set_socket_options(socket_settings)
File "C:\Users\Alexander\Anaconda3\lib\site-packages\amqp\transport.py", line 204, in _set_socket_options
self.sock.setsockopt(SOL_TCP, opt, val)
kombu.exceptions.OperationalError: [WinError 10042] An unknown, invalid, or unsupported option or level was specified in a getsockopt or setsockopt call
There is an open issue on github where the same OS-error has been seen:
https://github.com/celery/py-amqp/issues/130
Someone suggested in the comments on the issue that it is temporarily resolved by downgrading the version of amqp to 2.1.3
Steps to take in order to downgrade:
Uninstall amqp using $ pip uninstall amqp.
Install amqp using $ pip install -Iv amqp==2.1.3.