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

AttributeError: 'NoneType' object has no attribute 'SSLContext' #81541

Closed
kr-prince opened this issue Sep 27, 2019 · 4 comments
Closed

AttributeError: 'NoneType' object has no attribute 'SSLContext' #81541

kr-prince opened this issue Sep 27, 2019 · 4 comments
Labels
*caused-by-extension Issue identified to be caused by an extension

Comments

@kr-prince
Copy link

Steps to Reproduce:

  1. Launch VS Code and copy the below simple Flask App Code
#!flask/bin/python
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return "Hello, World!"

if __name__ == '__main__':
    app.run(debug=True)
  1. Start debugging using Flask
  2. Expectation is that the code will run and start the Flask app on the default port, but actually the terminal freezes, and after sometimes the below error comes up :

PS D:\Projects\PyNLP-Rest_Src\src> & 'D:\Continuum\anaconda3\envs\mainEnv\python.exe' 'c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\ptvsd_launcher.py' '--default' '--client'
'--host' 'localhost' '--port' '50449' '-m' 'flask' 'run'
Traceback (most recent call last):
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\ptvsd_launcher.py", line 45, in
main(ptvsdArgs)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_main_.py", line 265, in main
wait=args.wait)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_main_.py", line 258, in handle_args
debug_main(addr, name, kind, *extra, **kwargs)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_local.py", line 43, in debug_main
run_module(address, name, *extra, **kwargs)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_local.py", line 68, in run_module
run(argv, addr, **kwargs)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_local.py", line 140, in _run
_pydevd.main()
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py", line 1925, in main
debugger.connect(host, port)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py", line 1283, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "c:\Users\1120978.vscode\extensions\ms-python.python-2018.12.0\pythonFiles\lib\python\ptvsd_vendored\pydevd\pydevd.py", line 1307, in _exec
runpy._run_module_as_main(module_name, alter_argv=False)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\flask_main
.py", line 15, in main(as_module=True)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\flask\cli.py", line 966, in main
cli.main(prog_name="python -m flask" if as_module else None)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\flask\cli.py", line 586, in main
return super(FlaskGroup, self).main(*args, **kwargs)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 1135, in invoke
sub_ctx = cmd.make_context(cmd_name, args, parent=ctx)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 641, in make_context
self.parse_args(ctx, args)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 940, in parse_args
value, args = param.handle_parse_result(ctx, opts, args)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 1477, in handle_parse_result
self.callback, ctx, self, value)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\click\core.py", line 96, in invoke_param_callback
return callback(ctx, param, value)
File "D:\Continuum\anaconda3\envs\mainEnv\lib\site-packages\flask\cli.py", line 742, in _validate_key
is_context = isinstance(cert, ssl.SSLContext)
AttributeError: 'NoneType' object has no attribute 'SSLContext'

Some the links I tried to solve the issue have been mentioned below. I tried to revert python extension and VS Code to older versions (9-10 months back), changing settings.json file. But nothing helped.
#3272
debugging-a-script-in-vs-code-is-causing-an-attributeerror
#1581

@chrmarti
Copy link
Contributor

/causedByExtension

This is caused by the Python extension. Please file a new issue for it: https://github.com/microsoft/vscode-python/issues/new/choose

@vscodebot vscodebot bot added the *caused-by-extension Issue identified to be caused by an extension label Sep 27, 2019
@vscodebot
Copy link

vscodebot bot commented Sep 27, 2019

This issue is caused by an extension, please file it with the repository (or contact) the extension has linked in its overview in VS Code or the marketplace for VS Code. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Sep 27, 2019
@kr-prince
Copy link
Author

/causedByExtension

This is caused by the Python extension. Please file a new issue for it: https://github.com/microsoft/vscode-python/issues/new/choose

@chrmarti could you place let me know where I have to raise this issue? (Or how do I find the correct platform?) The link which you have mentioned is the same one I used before. Did I choose any wrong option there?

@chrmarti
Copy link
Contributor

@kr-prince Have you filed this with the Python extension before? (This here is VS Code's main issue tracking.)

Looking at the error again, it looks like this might be an issue with your Anaconda installation or the mainEnv environment. Maybe StackOverflow can help you with that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*caused-by-extension Issue identified to be caused by an extension
Projects
None yet
Development

No branches or pull requests

2 participants