module 'pycodestyle' has no attribute 'missing_whitespace_around_operator'
adrianwix opened this issue · comments
Python Code
Command Line and Configuration
.pep8
, setup.cfg
, ...
Whatever comes as default after installing autopep8 for the first time
Command Line
$ autopep8 -a -a --in-place --recursive --exclude postgres,pgadmin,demo_data .
Your Environment
- Python version: 3.10
- pycodestyle = ">=2.10.0"
- autopep8 version: *
- Platform: macOSX
- Running in pipenv
I can't find a missing_whitespace_around_operator
anywhere inside https://github.com/PyCQA/pycodestyle
Running into this as well. I think https://pypi.org/project/pycodestyle/#history released a breaking change in 2.11.0 that is hitting this. As a temporary fix I'm able to pin pycodestyle to 2.10.0, but ideally autopep8 would be able to handle this out of the box now.
I can confirm that problem in our code checking also. We use autopep8==2.0.2
and the stack trace is the following:
Traceback (most recent call last):
File "<Project path here>/.venv/bin/autopep8", line 8, in <module>
sys.exit(main())
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 4528, in main
results = fix_multiple_files(args.files, args, sys.stdout)
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 4423, in fix_multiple_files
ret = _fix_file((name, options, output))
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 4393, in _fix_file
return fix_file(*parameters)
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 3589, in fix_file
fixed_source = fix_lines(fixed_source, options, filename=filename)
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 3569, in fix_lines
fixed_source = fix.fix()
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 613, in fix
self._fix_source(filter_results(source=''.join(self.source),
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 557, in _fix_source
modified_lines = fix(result)
File "<Project path here>/.venv/lib/python3.9/site-packages/autopep8.py", line 761, in fix_e225
pycodestyle.missing_whitespace_around_operator(fixed, ts))
AttributeError: module 'pycodestyle' has no attribute 'missing_whitespace_around_operator'
There are several pull requests for this; #699, #696, #691, #690 are all the same. I suggest someone look into this comment and push their PR forward with a solution.
For the records, I had the same problem with pycodestyle 2.10.0. Just now, I tried it with 2.11.1 and it seems to be solved.
Is solution to this error avaiable now or we have to wait?
Errors still remains on my setup (python 3.11) :
pycodestyle==2.11.1
autopep8==2.0.4
This problem is solved in https://github.com/hhatto/autopep8/pull/699/files.
This change has also been released in autopep8 v2.0.4.
Please add a new issue if you have problems. Please include a code example of when the problem occurs.
I got this problem with my pre-commit configuration, the solution was update the hook to the last version.
pycodestyle==2.11.1
autopep8==2.0.4
Python 3.11
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: v2.0.4
hooks:
- id: autopep8
I got this problem with my pre-commit configuration, the solution was update the hook to the last version.
pycodestyle==2.11.1 autopep8==2.0.4 Python 3.11
- repo: https://github.com/pre-commit/mirrors-autopep8 rev: v2.0.4 hooks: - id: autopep8
That worked, thanks !