GitHub 操作:pylint 失败并显示 F0001:没有名为 __init__.py 的模块(严重)
GitHub Actions: pylint fails with F0001: No module named __init__.py (fatal)
以下 GitHub Pylint 启动工作流失败,出现大量 pylint
F0001 错误。
这是
github-workflow源代码:
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint `ls -R|grep .py$|xargs`
这些是工作流输出的错误:
Run pylint $(ls -R | grep '.py$' | xargs)
************* Module __init__.py
__init__.py:1:0: F0001: No module named __init__.py (fatal)
__init__.py:1:0: F0001: No module named __init__.py (fatal)
************* Module pet.py
pet.py:1:0: F0001: No module named pet.py (fatal)
************* Module Authorization.py
Authorization.py:1:0: F0001: No module named Authorization.py (fatal)
************* Module Http.py
Http.py:1:0: F0001: No module named Http.py (fatal)
__init__.py:1:0: F0001: No module named __init__.py (fatal)
...
Error: Process completed with exit code 17.
为什么 pylint
找不到这些模块?
失败原因
GitHub 操作工作流在此处包含错误:
| run
pylint `ls -R|grep .py$|xargs`
解决方案
解决办法是更换:
pylint `ls -R|grep .py$|xargs`
作者:
pylint $(find . -name "*.py" | xargs)
错误说明
ls -R
returns 当前目录下的文件格式如下:
./dir1:
__init__.py file1.py
./dir1/dir2
__init__.py file2.py
如果您使用 grep .py$
过滤 ls -R
的输出,您将丢失 *.py
文件的路径。 pylint
找不到这些文件。
因此,pylint
失败并出现 F0001 错误:
$ pylint --help-msg=F0001
:fatal (F0001):
Used when an error occurred preventing the analysis of a module (unable to
find it for instance). This message belongs to the master checker.
以下 GitHub Pylint 启动工作流失败,出现大量 pylint
F0001 错误。
这是 github-workflow源代码:
name: Pylint
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pylint
- name: Analysing the code with pylint
run: |
pylint `ls -R|grep .py$|xargs`
这些是工作流输出的错误:
Run pylint $(ls -R | grep '.py$' | xargs)
************* Module __init__.py
__init__.py:1:0: F0001: No module named __init__.py (fatal)
__init__.py:1:0: F0001: No module named __init__.py (fatal)
************* Module pet.py
pet.py:1:0: F0001: No module named pet.py (fatal)
************* Module Authorization.py
Authorization.py:1:0: F0001: No module named Authorization.py (fatal)
************* Module Http.py
Http.py:1:0: F0001: No module named Http.py (fatal)
__init__.py:1:0: F0001: No module named __init__.py (fatal)
...
Error: Process completed with exit code 17.
为什么 pylint
找不到这些模块?
失败原因
GitHub 操作工作流在此处包含错误:
| run
pylint `ls -R|grep .py$|xargs`
解决方案
解决办法是更换:
pylint `ls -R|grep .py$|xargs`
作者:
pylint $(find . -name "*.py" | xargs)
错误说明
ls -R
returns 当前目录下的文件格式如下:
./dir1:
__init__.py file1.py
./dir1/dir2
__init__.py file2.py
如果您使用 grep .py$
过滤 ls -R
的输出,您将丢失 *.py
文件的路径。 pylint
找不到这些文件。
因此,pylint
失败并出现 F0001 错误:
$ pylint --help-msg=F0001
:fatal (F0001):
Used when an error occurred preventing the analysis of a module (unable to
find it for instance). This message belongs to the master checker.