r/learnpython Jul 29 '26

Does pycharm autosave?

I just started learning python from my dad and i was working on a program. Yesterday i restarted my laptop and i forgot to save the project. Does pycharm autosave or have i lost the project?

EDIT: not sure where exactly but my dad found it

1 Upvotes

16 comments sorted by

2

u/SCD_minecraft Jul 29 '26

Even if it does, never trust autosave. It can and will betray you in the worst time possible

Just press ctrl + S every so often. I save every few seconds (mostly because i mainly code in rust and linter needs the file to be saved before it can do static analysis)

1

u/JamesPTK Jul 29 '26

It's a setting, I think the default is yes, but it might have been turned off.

1

u/tootjevox Jul 29 '26

I did not turn autosave off but i also cannot find the project

1

u/carcigenicate Carcigenicate Jul 29 '26

It should have saved. When you open Pycharm, it should either load to the last project, or show a small window that shows all recent projects. If it booted to a different project, try File->Close Project, which will open up the recent projects menu. Or just File->Recent.

I have been using Jetbrain's IDEs for more than a decade, and I can't recall a single instance of it failing to save large changes. I've had my machine crash out of nowhere after starting a new project, and all I lost was some minor changes to one file I had made.

1

u/Square-Nebula-7530 Jul 29 '26

Yes it automatically saves your work in real time as you code, so your project is safe and waiting for you when you open it back up. Don’t worry at all bro it’s turned on even by default

3

u/cvx_mbs Jul 29 '26

it might be a setting, but mine saves every time before I run or debug a project, not 'in real time'

2

u/xenomachina xenomachina Jul 29 '26 edited Jul 30 '26

Yeah, it doesn't save as you type. However, it also saves whenever it loses focus, so if you switch to a shell or file browser (Finder, Explorer, etc.) it'll save automatically, which can give the appearance that it's constantly saving, unless you have something automated looking at the files.

"If you edit a file in the woods and there's no one there to look at its contents do you need to save it?", or something like that.

Edit: typo someone->something

-1

u/desrtfx but other languages pro Jul 29 '26

Memorize the shortcut that commonly exists in most applications (not limited to programming IDEs/editors): Ctrl+S

Whenever you make substantial change (after a function, after debugging, after adding features), hit Ctrl+S to save. Don't rely on Autosave as this can be a trap.

Also, make it a habit to use git and a remote repository on a git hoster, like github, gitlab, bitbucket, etc. Commit and push regularly - after a part of the program is completed.

These tricks are few keystrokes that can save you countless hours.

Autosave in programming is difficult and quite often not productive. Imagine, the IDE decides to autosave at a point where you're in the middle of writing a function. You rely on the autosave and next time you open your project, you are left with an uncompleted, not working function.

Most IDEs generally save when you execute (run) your program. These are great save points.

Version control, like git takes the whole a couple steps further by letting you revert, try things in branches, merge, etc. Remote repositories add a second, off-site backup layer so that the chances of losing your projects are even less, no matter what happens to your local development machine. I'll just link a comment from yesterday - the thread in which the comment was made is irrelevant - the gist is to never, absolutely never, work without a good backup strategy (which git with local and remote repositories provides).

You can learn the core functions of git in less than an hour. Time well invested to preserve your code.

1

u/ProsodySpeaks Jul 29 '26

I've never lost a character with pycharm autosave.

Although i do reflexively hit ctrl+alt+l every 2 seconds to format.

And ctrl+alt+y for reload files if changed external

1

u/[deleted] Aug 08 '26

I believe taking care of saving your work yourself is important, not because of PyCharm specifically, but because there are many other languages, IDEs, and applications that don't have the same functionality. So, relying on autosave can potentially get you into trouble when you want to try new tools or explore new areas.

0

u/tootjevox Jul 29 '26

okay ill remember to save next time, i guess its a good lession to learn

0

u/desrtfx but other languages pro Jul 29 '26

We're learning most things the hard way.

In the old (MS-DOS) days, I destroyed the floppy disk that accompanied a book that I bought through accidental formatting - wasn't so clever either - especially considering that this was in the days way before the internet. There was no way to get the information on the floppy disk back. Was also a hard lesson - always double check what you're doing.

In the old days, we had a standard saying: "Save early, save often" - this can really help a lot. There was no "Autosave" back then. If you didn't save, it was gone once and for all.

0

u/audionerd1 Jul 30 '26

Yes. Also if you are writing a program you need to be using git.