Skip to content

Commit 303654c

Browse files
Prevent crash in CI environnement if we can't write in pylint's cache
1 parent 72a202a commit 303654c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pylint/config/__init__.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,15 @@
9191
except OSError:
9292
pass
9393
# Create spam prevention file for today
94-
with open(spam_prevention_file, "w", encoding="utf8") as f:
95-
f.write("")
94+
try:
95+
with open(spam_prevention_file, "w", encoding="utf8") as f:
96+
f.write("")
97+
except Exception: # pylint: disable=broad-except
98+
# Can't write in PYLINT_HOME ?
99+
print(
100+
"Can't write the file that was supposed to "
101+
f"prevent pylint.d deprecation spam in {PYLINT_HOME}."
102+
)
96103

97104

98105
def _get_pdata_path(base_name, recurs):

0 commit comments

Comments
 (0)