Hi, I think the changes introduced in #1419 are causing the exclude logic to crash on startup with a UnicodeDecodeError.
Here's how to replicate this:
- In a path with
__pycache__ from old (pre-3.10) versions of Python (easy way appears to be python3.9 -m compileall .), add **/__pycache__/** to your exclude option in pytype.cfg (my use case is a Django project: I exclude **/migrations/ so that pytype doesn't complain about the auto-generated code)
- Using python 3.11, run
pytype --config pytype.cfg
- Observe the crash during startup.
The naive ways to fix this would be to either add in if f.endswith(".pyc"): continue in expand_source_files() or enclose the call to read the line in a try/except UnicodeDecodeError: return False
Hi, I think the changes introduced in #1419 are causing the exclude logic to crash on startup with a
UnicodeDecodeError.Here's how to replicate this:
__pycache__from old (pre-3.10) versions of Python (easy way appears to bepython3.9 -m compileall .), add**/__pycache__/**to yourexcludeoption inpytype.cfg(my use case is a Django project: I exclude**/migrations/so that pytype doesn't complain about the auto-generated code)pytype --config pytype.cfgThe naive ways to fix this would be to either add in
if f.endswith(".pyc"): continueinexpand_source_files()or enclose the call to read the line in atry/except UnicodeDecodeError: return False