python3 -m black ast.py
Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 188, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/lib/python3.9/runpy.py", line 147, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/usr/lib/python3.9/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "src/black/__init__.py", line 1, in <module>
File "/usr/lib/python3.9/asyncio/__init__.py", line 8, in <module>
from .base_events import *
File "/usr/lib/python3.9/asyncio/base_events.py", line 39, in <module>
from . import coroutines
File "/usr/lib/python3.9/asyncio/coroutines.py", line 5, in <module>
import inspect
File "/usr/lib/python3.9/inspect.py", line 778, in <module>
class _ClassFinder(ast.NodeVisitor):
AttributeError: module 'ast' has no attribute 'NodeVisitor'
For the current working directory to be removed from sys.path when black is run like this.
Describe the bug
When run with
python3 -m black(used by vscode) black keeps the current working directory insidesys.pathwhich can result in a crash if there are name conflicts between black's imports and the files in the current working directoryTo Reproduce
touch ast.pypython3 -m black ast.pyOutput:
Expected behaviour
For the current working directory to be removed from sys.path when black is run like this.
Environment