ashleysommer / sanic-cors

A Sanic extension for handling Cross Origin Resource Sharing (CORS), making cross-origin AJAX possible. Based on flask-cors by Cory Dolphin.
MIT License
159 stars 22 forks source link

On Prod, Getting error : ImportError: cannot import name 'CIDict' #26

Closed vikasmcajnu closed 6 years ago

vikasmcajnu commented 6 years ago

Sanic == 0.8.1 Sanic-Cors == 0.9.3 Connected to pydev debugger (build 181.4668.75) Traceback (most recent call last): File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1664, in main() File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1658, in main globals = debugger.run(setup['file'], None, None, is_module) File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/Applications/PyCharm CE.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/Users/vikas/Documents/fynd/gringotts/app.py", line 7, in from sanic_cors import CORS, cross_origin File "/Users/vikas/Documents/fynd/venv/gringotts/lib/python3.6/site-packages/sanic_cors/init.py", line 11, in from .decorator import cross_origin File "/Users/vikas/Documents/fynd/venv/gringotts/lib/python3.6/site-packages/sanic_cors/decorator.py", line 16, in from .core import * File "/Users/vikas/Documents/fynd/venv/gringotts/lib/python3.6/site-packages/sanic_cors/core.py", line 14, in from sanic.server import CIDict ImportError: cannot import name 'CIDict'

Please Fix it on priority.

ashleysommer commented 6 years ago

Sanic-CORS version 0.9.3 is an old version that only works with Sanic 0.7.0.

For newer sanic, the issue you are seeing was already fixed in https://github.com/ashleysommer/sanic-cors/releases/tag/0.9.4 and recently better compatibility with Sanic 0.8.1 was added in https://github.com/ashleysommer/sanic-cors/releases/tag/0.9.5

Please upgrade sanic-CORS to 0.9.5 to fix your issue.

logsv commented 6 years ago

Sanic-CORS version 0.9.3 is an old version that only works with Sanic 0.7.0.

For newer sanic, the issue you are seeing was already fixed in https://github.com/ashleysommer/sanic-cors/releases/tag/0.9.4 and recently better compatibility with Sanic 0.8.1 was added in https://github.com/ashleysommer/sanic-cors/releases/tag/0.9.5

Please upgrade sanic-CORS to 0.9.5 to fix your issue.

Thanks for reply. It's worked for sanic sanic ==0.7.0.