Skip to content

TypeError: __call__() missing 1 required positional argument: 'send' #1735

Description

@Zhaoxun

relating code in consumers.py:

from channels.generic.websocket import AsyncWebsocketConsumer
import json

class Trade(AsyncWebsocketConsumer):

    async def my_send(self, data):
        if isinstance(data, dict):
             d = json.dumps(data)
        else:
            d = str(data)
        await self.send(d)

OS =Windows 7-64bit
Python = 3.7.9

pip-freeze:

daphne==3.0.2
Django==3.2.6
docopt==0.6.2
et-xmlfile==1.0.1
future==0.18.2
hyperlink==21.0.0
idna==2.10
importlib-metadata==3.7.2
incremental==21.3.0
numpy==1.20.1
openpyxl==3.0.7
pandas==1.2.3
pefile==2019.4.18
pipdeptree==2.0.0
pipreqs==0.4.10
pyasn1==0.4.8
pyasn1-modules==0.2.8
pycparser==2.20
pyinstaller==4.2
pyinstaller-hooks-contrib==2021.1
pyOpenSSL==20.0.1
PyQt5==5.13.0
PyQt5-sip==12.8.1
pyqt5-tools==5.13.0.1.5
python-dateutil==2.8.1
python-dotenv==0.15.0
pytz==2021.1
pywin32-ctypes==0.2.0
requests==2.25.1
service-identity==21.1.0
six==1.15.0
sqlparse==0.4.1
Twisted==21.7.0
twisted-iocpsupport==1.0.1
txaio==21.2.1
typing-extensions==3.7.4.3
urllib3==1.26.4
websocket-client==1.1.1
websockets==8.1
xlrd==1.2.0
XlsxWriter==1.3.7
xlwt==1.3.0
yarg==0.1.9
zipp==3.4.1
zope.interface==5.4.0

full Traceback:

daphne.server - ERROR - Exception inside application: call() missing 1 required positional argument: 'send'
Traceback (most recent call last):
File "C:\Python37\Lib\site-packages\channels\staticfiles.py", line 44, in call
return await self.application(scope, receive, send)
File "C:\Python37\Lib\site-packages\channels\routing.py", line 71, in call
return await application(scope, receive, send)
File "C:\Python37\Lib\site-packages\channels\sessions.py", line 47, in call
return await self.inner(dict(scope, cookies=cookies), receive, send)
File "C:\Python37\Lib\site-packages\channels\sessions.py", line 263, in call
return await self.inner(wrapper.scope, receive, wrapper.send)
File "C:\Python37\Lib\site-packages\channels\auth.py", line 185, in call
return await super().call(scope, receive, send)
File "C:\Python37\Lib\site-packages\channels\middleware.py", line 26, in call
return await self.inner(scope, receive, send)
File "C:\Python37\Lib\site-packages\channels\routing.py", line 160, in call
send,
File "C:\Python37\Lib\site-packages\asgiref\compatibility.py", line 35, in new_application
return await instance(receive, send)
TypeError: call() missing 1 required positional argument: 'send'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions