Chunks of script disappearing

I’ve done some python scripting and testing then after stopping game I noticed that big chunk of of script just disappeared, pressing CTRL + Z or CTRL + ALT + Z did nothing.

After noticing that I didn’t save and separately opened same saved file but it was also gone there. Considering I save almost after any tiny change, because blender sometime crash, its very strange.

Same thing did happen previously but with smaller pieced of code, then i thought I might be imagining things…

Anyone else noticed that?
Is this a bug and should just try another build or is there a short cut (that I might accidentally pressed) to revert blend file to some previous state?

This happened over several different blend files, with 2.71 HASH 939503a

I’ve had it happen before. It seems to happen most regularly with using CTRL +Z in the text editor. I think sometimes it happens when you modify something in the main window, then write some text, then Undo in the main window. Other times it happens when you select a lot of text, delete it and then change your mind and try to undo. Not everything gets restored.

Best to save often. For important projects I always make a new save file (i.e. demo_36.blend) every time before I make a major change or every time I have a stable working blend. That means if things don’t work out I can go back to my last stable version of the project. It also means I can lift parts of code from there and try to fix the broken version.

Another thing you can do is use an external python interpreter for working with your scripts. The internal text editor is pretty bad and even IDLE, the interpreter that is packaged with python is better (It has color coded text highlighting etc…). Just make sure you get the right version of IDLE, as I once had a problem when using the python 2.7 IDLE program with newer blender, most of the stuff is the same, but there were problems with changes to the pickle module.

Thank you for info.

Is there some way to use Python interpreters with Blender that I’m not aware of, or are you referring to an IDE?

I mean IDE sorry. :slight_smile: I forgot what the initials stood for; Integrated Development Environment apparently.
I was thinking interpreter, blah, blah. Too tired today. ㅠㅠ

I don’t know which one is best, but here’s a comparison of some which are available:

I use Pycharm as it works really well and has some nice code-completion. There’s also a set of BGE API functions to help development.