microsoft/vscode-autopep8

autopep8 didnt work well in vs code

Closed this issue · 4 comments

psoan commented

File "c:\Users\Parham\AppData\Local\Programs\Python\Python39\lib\site-packages\autopep8.py", line 419, in
del pycodestyle._checks['logical_line'][pycodestyle.continued_indentation]
KeyError: <function continued_indentation at 0x0000020C8E8F3AF0>
When I used shift + alt + f I received this error!

@psoan Can you share full logs from Output > autopep8?

psoan commented

@psoan Can you share full logs from Output > autopep8?

Traceback (most recent call last):
  File "c:\Users\Parham\.vscode\extensions\ms-python.autopep8-2023.4.0\bundled\tool\lsp_server.py", line 421, in _run_tool_on_document
    result = utils.run_module(
  File "c:\Users\Parham\.vscode\extensions\ms-python.autopep8-2023.4.0\bundled\tool\lsp_utils.py", line 147, in run_module
    return _run_module(module, argv, use_stdin, source)
  File "c:\Users\Parham\.vscode\extensions\ms-python.autopep8-2023.4.0\bundled\tool\lsp_utils.py", line 132, in _run_module
    runpy.run_module(module, run_name="__main__")
  File "c:\Users\Parham\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 213, in run_module
    return _run_code(code, {}, init_globals, run_name, mod_spec)
  File "c:\Users\Parham\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "c:\Users\Parham\AppData\Local\Programs\Python\Python39\lib\site-packages\autopep8.py", line 414, in <module>
    del pycodestyle._checks['logical_line'][pycodestyle.continued_indentation]
KeyError: <function continued_indentation at 0x00000156C71A5550>

@psoan Can you share the initial part of the logs? What are the settings being passed to autopep8

Note: that this is an issue with autopep8 itself. I have applied the recommended mitigation, but that does not seem to work in your case. I will need the settings to figure out if there is anything specific. hhatto/autopep8#625

Please leave a response on that issue.

Another thing you can try is set autopep8.path to autopep8 installed in your environment.

This should be fixed in pre-release. This used to occur if the file was not in the workspace.