Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: name 'CIMultiDict' is not defined #116

Open
gMan1990 opened this issue Jun 2, 2020 · 3 comments
Open

NameError: name 'CIMultiDict' is not defined #116

gMan1990 opened this issue Jun 2, 2020 · 3 comments

Comments

@gMan1990
Copy link

gMan1990 commented Jun 2, 2020

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 gMan1990 closed this as completed Jun 2, 2020
@gMan1990
Copy link
Author

gMan1990 commented Jun 3, 2020

see ashleysommer/sanic-cors#34

@gMan1990 gMan1990 reopened this Jun 4, 2020
@gMan1990
Copy link
Author

gMan1990 commented Jun 4, 2020

  • scylla/requirements.txt
sanic==19.6.3
sanic-cors==0.9.9
try:
    from sanic.compat import Header
except ImportError:
    try:
        from sanic.server import CIMultiDict
    except ImportError:
        from sanic.server import CIDict as CIMultiDict

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

@hittimes
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants