You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
Start debugging using Flask
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
The text was updated successfully, but these errors were encountered:
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.
@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?
@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.
VSCode Version: 1.38
OS Version: Win 10 64 Bit Enterprise SoEv1.3 - Version (1703)
Conda Info -
active environment : mainEnv
active env location : D:\Continuum\anaconda3\envs\mainEnv
shell level : 2
user config file : C:\Users\1120978.condarc
populated config files : C:\Users\1120978.condarc
conda version : 4.5.4
conda-build version : 3.10.5
python version : 3.6.5.final.0
base environment : D:\Continuum\anaconda3 (writable)
channel URLs : https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/free/win-64
https://repo.anaconda.com/pkgs/free/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/pro/win-64
https://repo.anaconda.com/pkgs/pro/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
package cache : D:\Continuum\anaconda3\pkgs
C:\Users\1120978\AppData\Local\conda\conda\pkgs
envs directories : D:\Continuum\anaconda3\envs
C:\Users\1120978\AppData\Local\conda\conda\envs
C:\Users\1120978.conda\envs
platform : win-64
user-agent : conda/4.5.4 requests/2.18.4 CPython/3.6.5 Windows/10 Windows/10.0.15063
administrator : True
netrc file : None
offline mode : False
Steps to Reproduce:
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
The text was updated successfully, but these errors were encountered: