___jb_bak___ and ___jb_old___ files in PyCharm

2019-02-01 20:54发布

问题:

When I got some PyCharm project from my colleague I saw some backup files of *.py files.

This files have types: *.___jb_old___ and *.___jb_bak___.

I open the files in Notepad++ and see that these are identical backup files of the corresponding *.py files. I asked my colleague, but he didn't know what these are.

  1. Why are there TWO identical backup files for each *.py file?
  2. How can I tune PyCharm? We want to turn off this backup.

Google gave me nothing :(

回答1:

You can disable "safe write"

Use "safe write" (save changes to a temporary file first) If this check box is selected, a changed file will be first saved to a temporary file; if the save operation is completed successfully, the original file is deleted, and the temporary file is renamed.

https://www.jetbrains.com/webstorm/help/system-settings.html



回答2:

i had this problem in webstorm when a script file was running and i was editing it in webstorm. when i stopped the script and edited it everything was fine



回答3:

While JeremyWeir's solution probably does work, the real fix - imo - is to enable write permission on the directory.

Saving a file would only need write permission to that file itself. But with the "safe write", you need permission to create the file and rename it - which means you need write access to the directory.

In Linux this would be e.g. chmod ug+w DIR, if you want to give write access to user and group.



回答4:

it's a temporary file used by PyCharm to make sure you change will not be lost when editing files. it's safe to delete them manually, you will only loss very recent changes. IntelliJ IDEA works the same as PyCharm.

How to delete them? To delete a file on a file system requires two things: 1)you have the permission. 2)no program is using it. so make sure you have 'w' the permission, and stop all program which is using it. then you can remove it.

How to know which program is using it? Normally you should already know it. but sometimes some background programs(like crash plan, google drive sync, e.g.) may also hold it quietly, then find and kill all programs may be very tricky. the easiest way is reboot your computer with 'safe mode', in which only the OS kernel is loaded. I spend two hours to figure out the reason why I cannot delete the temp file even when I have whole permission. a crash plan service is holding it in background. This may not be your issue, but if you cannot delete the temp file, this will save your time.



回答5:

I have exact same issue with PhpStorm after system crash. The fix I found was to manualy delete *._jb_old_ and *._jb_bak_ files and reinstall PhpStorm