Hi. I get the Text File into Blender with:
bpy.ops.text.open()
That works, but the new Textblock is marked red, and .users is 0. ???
Saving the blend, and reopen does solve this, but it look weird to me.
Yes, that’s exactly what i’m doing. This is strange.
The only Thing i can do wrong here ist the Filepath. But i have also a String as you do.
bpy.data.texts[‘Text’].use_fake_user gives False, as all other Scripts.
No, its not Game Engine.
Edit :::::::::::::
I tried now in a plain blend File, and a fresh Script. That works. ???
But out of my AddOn, it fails with this effect.
Edit :::::::::::::
When running as plain Script with Alt+P, out of the Text Editor, it works. But not if i click my AddOn Button with this Function.
Edit :::::::::::::
Ok, i knowed i remember right. Because this did not happened in my earlier Versions. So i’ve tried it again in Blender 2.74, and there it worked correctly. That means it could be a Bug?
Ok, i think this is a Blender Bug. Because i can confirm this out of a fresh blend. It happens, when loading outside the Text Editor. Here is a Script you can try: OpenBug.py (1.0 KB)
It creates a Button in the Scene Properties. Place a *.txt on the C: Drive, run the Script with Alt+P and load the txt with the Button. You need to rename the File to load in the Script.
I was able to get the 0 users error, if I run the code without the “use_fake_user”.
Here’s a operator in scene properties if you want to test it.
I think your issue was trying to use a text operator outside of text editor. You prolly have to have a text editor open and run from the text editor for it to work.
Thank you. But it is not intended that scripts have a fake user. Even with 0 users the loaded Script is saved with the *.blend. And on the next reload, the Problem is gone. So, it looks only cosmetic to me. I call the function out of a Node-AddOn. I want do make a Tutorial Video about this AddOn and i just want to make sure i do not make any mistakes.
The same Script work without this Problem in 2.74. I think this is a Bug.