scylla icon indicating copy to clipboard operation
scylla copied to clipboard

NameError: name 'CIMultiDict' is not defined

Open gMan1990 opened this issue 4 years ago • 3 comments

Describe the bug

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/sanic/app.py", line 985, in handle_request
    request, response
  File "/usr/local/lib64/python3.6/site-packages/spf/framework.py", line 653, in _run_response_middleware_18_12
    _response = await _response
  File "/usr/local/lib64/python3.6/site-packages/sanic_cors/extension.py", line 267, in unapplied_cors_response_middleware
    set_cors_headers(req, resp, context, res_options)
  File "/usr/local/lib64/python3.6/site-packages/sanic_cors/core.py", line 254, in set_cors_headers
    headers_to_set = get_cors_headers(options, req.headers, req.method)
  File "/usr/local/lib64/python3.6/site-packages/sanic_cors/core.py", line 175, in get_cors_headers
    headers = CIMultiDict()
NameError: name 'CIMultiDict' is not defined

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

gMan1990 avatar Jun 02 '20 21:06 gMan1990

see https://github.com/ashleysommer/sanic-cors/issues/34

gMan1990 avatar Jun 03 '20 02:06 gMan1990

  • scylla/requirements.txt
sanic==19.6.3
sanic-cors==0.9.9
  • https://github.com/ashleysommer/sanic-cors/blob/0.9.9/sanic_cors/core.py
try:
    from sanic.compat import Header
except ImportError:
    try:
        from sanic.server import CIMultiDict
    except ImportError:
        from sanic.server import CIDict as CIMultiDict
  • https://github.com/huge-success/sanic/blob/v19.6.3/sanic/compat.py class Header(CIMultiDict):

所以就是from sanic.compat import Header不会ImportError,然后就是NameError: name 'CIMultiDict' is not defined了。 这 code review 有木有问题?

gMan1990 avatar Jun 04 '20 08:06 gMan1990

docker 启动也有这个错误 NameError: name 'CIMultiDict' is not defined

hittimes avatar Sep 13 '20 04:09 hittimes