PyCharm constantly ignores files without mandate

已回答

I have a setup  where I work with network files from two sides. On one side I have access to git but no Python, on the other side it's the other way round. Since there are no VCS installed on the machine running PyCharm, I deactivated all related plugins. Still, PyCharm constantly sets random files on “ignored”. 

Random in the sense that 
1) none of these files are in the .gitignore file
2) invalidating the cache resolves the issues for the moment but the problem reoccurs after at most a couple of days (sometimes after the next PyCharm restart, sometimes later; I have not figured out yet when the problem reoccurs)

Is there a way to tell PyCharm to not ignore any file in a project?

 

PyCharm 2025.1 running on Windows Server 2019 Standard

0

Still, PyCharm constantly sets random files on “ignored”.

Could you please advise what you mean by ignored? Are you referring to Settings (`⌘ + ,` or `Ctrl + Alt + S`) > Editor > File Types > Ignored Files and Folders? What are the symptoms of files being ignored? Are they highlighted with a different color in the project view or something different?

0

No, the files are not listed there. 

In the project view, the filenames were highlighted with a color that changed when I picked a different color for ignored files back when the VCS plugins were active.

The main issue is, that these files are ignored when it comes to code completion or simply file inspections. Imports are marked erroneous (unresolved attributes) but they are no problem when running a file with an import. 

And, last but not least: I cannot open these files but in a right split. Double clicking has no effect.

0

Thank you for the information.

Is it possible to share a screen recording that shows the mentioned issues in your IDE? It would help to better understand the problem you encountered. You can zip and upload files securely here: https://uploads.jetbrains.com, just provide the uploaded file ID.

Also, please try the following:

  • Close IDE and delete the IDE system directory. It will recreate the IDE indexes and caches from scratch. Sometimes indexes and caches can get corrupted and cause unexpected behavior.
  • Close IDE, delete .idea folder and any *.iml files in your project root folder in file explorer, and re-import the project from existing sources. If you have many project settings (like run configurations etc.), you can backup this folder before deleting it.
0

Thank you for your assistance, Ivan!

I fear I cannot provide you with any screen recordings. What did you hope to see there? Can I clarify anything described earlier?

I tested your ideas and deleted both the system directory and the .idea folder (there were no *.iml outside). After a fresh start, all files behave normally at first but after a short while of updating the Python interpreter they are marked orange again and I cannot open them directly (only in a split pane). However, this fresh start made me notice that when I run a file in a run pane (instead of a console), I get an AttributeError: partially initialized module ‘ast’ has no attribute ‘NodeVisitor’ (most likely due to a circular import). Running in debug mode, I get an AttributeError as well: partially initialized module ‘inspect’ has no attribute ‘cleandoc’ (most likely due to a circular import). I cannot exclude that my code causes these exceptions but since (1) both ast and inspect are packages for code analysis and (2) the code runs smoothly with a python console, I can think of it being a relevant hint.

0

@J-oe

In the project view, the filenames were highlighted with a color that changed when I picked a different color for ignored files back when the VCS plugins were active.

I'm trying to understand what is the file highlighting in your particular case? If it is related to VCS ignore feature (e.g. .gitignore) or something else. Are you using git as version control in your project? Do you have the .gitignore file in your project root?

The screenshare would help understand this, and also how the file is opened in the split view automatically. If you could share some screenshots showing your IDE it would be helpful. Thanks!

0

In my first post, I described the general setup, but I give you now some further details.

  • It is a git repository and there is a .gitignore-file in the root folder. But there is no overlap between the files ignored by PyCharm and the files listed in .gitignore. There is another .gitignore-file in the .idea-folder but this one is almost empty and there is no overlap as well.
  • I noticed the issue when I had problems opening some files. These files had some color highlighting in common which I did not know at that time. I searched the settings and did not find anything. Somewhere (probably online) I got the idea that these files might be ignored. This confused me as all VCS plugins were deactivated. Nevertheless, I reactivated them and suddenly I found the settings for the highlighting in Settings > Version Control > File Status Colors, and there: Ignored. Changing the color for “Ignored” changed the highlighting of the files in question. This is why I started calling these files "ignored".

A comment on the behaviour: I normally open files for editing with a double click. This does not work with these ignored files. However, I noticed that "Rightclick on filename > Open in Right Split" opens such a file; in a right split pane but at least the file is open in the editor. This is the only way I can edit these files in PyCharm. I cannot backtrack objects to them (Ctrl+Leftclick), objects defined within are not considered for autocomplete and their content is not considered when searching my project for some string with Ctrl+Shift+F. Importing (from) these files, however, works without any problems.

Also I have problems with reproducability: turning the VCS plugins on and off again (for finding “Settings > Version Control > File Status Colors” above) resulted in no ignored files right now. I opened a file (x.py) and restarted PyCharm just out of curiousity. Afterwards, all of the files ignored before (probably, I do not keep exact track, yet) were ignored again - with one exception: x.py. So I tried this one more time, turned the plugins on and off. This time, however, all files were ignored, including x.py.

“import OE” autocompleted to “import OESL”. Then, “.ba” autocompleted to “.basic”. Then, PyCharm suggested several modules in OESL.basic but not “graph”. Also, autocompleting “.gr” resulted in “No suggestions” (as well as “.gra” and “.grap”). As you can see on the right hand side of this collage of two screenshots: objects imported from these ignored files cause erroneously many errors in other files.

0

Hi @...,

As a general troubleshooting step—and to ensure we're not addressing already resolved issues—please update to the latest 2025.2 release and check whether the issue persists.

If the problem continues, kindly create a new issue on YouTrack (https://youtrack.jetbrains.com/issues/PY) and attach all relevant information, including:

  • IDE logs (Help | Collect Logs and Diagnostic Data)
  • A minimal project sample that can reproduce the issue

This will help us investigate more efficiently.

0

Well, I work in a production environment where I do not have admin rights; so I'm bound to version 2025.1, for the moment. Also, an MWE is hard to produce when there is no apparent rule the issue follows. 

 

Coming back to my original question: is there a way to tell PyCharm not to ignore any file at all?

0

@J-oe, this doesn't look like an expected behavior. Please create a new issue on YouTrack (https://youtrack.jetbrains.com/issues/PY) and attach all relevant information, including logs collected via Help | Collect Logs and Diagnostic Data. This will allow us to identify possible errors.

0

帖子评论已关闭。