1
$\begingroup$

I reinstalled Blender freshly from blender.org and I noticed that, after working on a file, the size of destination folder where Blender is installed has increased and I don't know if this usual. Because the size of this directory has changed, this brings me to the question: can I modify/remove/add some python files (which are essential) by accident by just working normally on a blend file?

In case of removing or modifying a python file, will Blender continue working (and there is chance of data loss in my blend.file) or will Blender give an error and quit immediately?

$\endgroup$
  • $\begingroup$ As far as I'm concerned No Yes No and No ;) But you can't be 100% sure, always can happen "something", so make sure to save your work every now and then. $\endgroup$ – Vitaliy Jul 2 '15 at 16:19
  • $\begingroup$ I did save the files, but I don't know if modifying an essential python file cause data loss in the to be opened blend file (like the data loss can have when you open a new version file in an older version of Blender) :) $\endgroup$ – Faceb Faceb Jul 2 '15 at 16:24
  • 2
    $\begingroup$ You can't have a data loss until you save your file. Blender will give an error as soon as missing essential file is accessed. How it will behave greatly depends on what is missing. It can crash, or just give you an error, but I'm quite sure it can't just continue like nothing happened. $\endgroup$ – Vitaliy Jul 2 '15 at 16:33
2
$\begingroup$

Well… There are several questions here actually:

I. Is it normal that the installation directory of Blender grows after the first launch?

YES: Blender is only distributed with “pure” python files, the first time those get used/executed, the python interpreter will sort of compile them into an intermediary “machine language” code (similar to assembler, but universal and that still has to be interpreted by the python engine, not directly by the processor). You can find all those .pyc files in special __pycache__ directories next to all py modules (UI scripts, addons,.etc.).

See also this thread and the official py doc.

II. Can I modify some Blender's python files by accident by just working normally on a blend file?

NO: Usual editing of a .blend file will never touch anything on your file system. Unless it has been manually and maliciously crafted to do so, of course (a .blend file can easily execute arbitrary python code, which means it can wipe out your whole system if it wants to) - that’s why in .blend opening settings you have an option to “trust” the file or not.

III. Can I modify some of Blender scripts such that they delete and/or corrupt data in .blend files?

NO in general, but YES if you really want it. @Vitaliy already answered the general case: modifying “randomly” some script files of Blender is highly unlikely to have any bad effect on your saved data, it is much much more probable that it will just very soon error.

However, it is possible to modify a py script such that it breaks saving valid data (the simplest way to do so is to register a save_pre handler, and in that handler to e.g. delete all scenes or other nasty things like that. You can also generate invalid data (broken mesh, etc.) that will crash Blender on next load of the file, but that’s not so obvious to do. But yes, if you really want to, you do can break saving of .blend files from py script, like pretty much anything else in Blender.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.