New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does pylint decide where it should put stat files? #6394
Comments
One thing that could prevent using the XDG_HOME is if an env var for PYLINTHOME exists. Relevant code: |
Another issue might be that by using I followed the mentioned topic somewhat but haven't fully kept up. Is there an easily reproducible example? I'd be happy to try and investigate what is happening inside diff --git a/pylint/config/__init__.py b/pylint/config/__init__.py
index b8fb0a0b..87b9ef24 100644
--- a/pylint/config/__init__.py
+++ b/pylint/config/__init__.py
@@ -95,12 +95,15 @@ def load_results(base):
def save_results(results, base):
+ print(base)
+ print(PYLINT_HOME)
if not os.path.exists(PYLINT_HOME):
try:
os.makedirs(PYLINT_HOME)
except OSError:
print(f"Unable to create directory {PYLINT_HOME}", file=sys.stderr)
data_file = _get_pdata_path(base, 1)
+ print(data_file)
try:
with open(data_file, "wb") as stream:
pickle.dump(results, stream) Could also help investigate some of the variables within that function. |
@DanielNoord @Pierre-Sassoulas Thanks for the input, I will try and look into it. for the minimal repro, unfortunately we have not been able to narrow down the parameters that cause. It seems to be specific to the permissions and how the server hosting pylint itself is launched. The information above might help narrow this down. |
@karthiknadig Feel free to ping me in the other issue if needed! I'd be glad to provide any other diffs or fix-branches that might solve the issue. From what I gathered from the discussion until now it is still not clear whether the issue is with the user, the extension or pylint's internals. Happy to help narrow that down! |
I have opened the issue for the extension. I think I found the reason (microsoft/vscode-pylint#30 (comment)) and there is now a reproducible example (microsoft/vscode-pylint#30 (comment)). |
Just to update: I have been working on a fix in DanielNoord#135. I just need to test with the original reporter once more if this does indeed work and then I'll submit the patch. |
Question
I am from the VS Code python extension team, working on building an extension for VS Code using pylint. We have pre-release version out. An issue was reported on the extension that it creates pylint stat files in the project directory. We are not specifically passing anything to change the stat file location (see issue here microsoft/vscode-pylint#30).
Generally, the stat files go into pre-set directory like %USERPROFILE%/AppData/Local/pylint on windows. What can cause these to be written to the current working directory.
We use pass the source code into pylint via stdin, and the only two arguments we use are
--reports=n
,--output-format=json
. Any clue to debug this would be helpful.Documentation for future user
I could not find fall back location for the stat files and when would the fallback location be used.
Additional context
We use
runpy.run_module
to run pylint, and we send source to pylint via stdin.Relevant code here: https://github.com/microsoft/vscode-pylint/blob/725fc7ae415a9638e2a44e922cf5133efde62811/bundled/linter/utils.py#L146-L168
The text was updated successfully, but these errors were encountered: