'Autopep8 format "max-line-length" parameter is not working for the imports section

I'm using autopep8 auto-formatter in VSCode (MacOs) but I can't seem to make it work to split lines greater than max-line-length in the imports section. In the rest of the code file, it works well, but not in the imports section. These are my configurations in settings.json:

"python.languageServer": "Pylance",
"python.formatting.autopep8Args": [
"--max-line-length",
"80",
],
"python.formatting.provider": "autopep8",
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": false,
"python.linting.enabled": true,

Any idea why?



Solution 1:[1]

You have to specify the length as value, not parameter, like so:

 "python.formatting.autopep8Args": [
        "--max-line-length=80"
        ],

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Spartan