Text Editor Inconsistanty Ignores Script Changes

I was working on a gui script in the text editor and made some errors. I deleted back further and further until I literally removed the whole script. Still, I have one view “TX: Text” that completely ignores every change and just gives me a grey blank that I have to push the “left arrow” button to get out of.

I literally have it reduced to where TX: Text has nothing but a

print “Hello there”

message and it behaves the same way. When I switch to TX: Text.001 and write a similar print statement, it works just fine. The only difference is “Text.001” never had any gui code while “Text” did.

Does anyone know what causes this?

your pc processor reads bianary, not the script you wrote. so python takes what you wrote and converts in into instructions you processor can read, thats why python is called an interpited language. the act of python interpiting your script takes time, which isn’t noticable in small scripts but become more noticable the larget the script is. so to save time once pythin has interpiter has interpited your script it saves the interpited version so it cna just load the interpited version and not waste time interpoting the same thing again. after you run a script the first time you will notice python has created a new file with the same namy but the extension ends with .pyc rather than just .py . the pyc is the interpited/compiled version. and thats the version it loads, not the version you edited.

to over ride that and make it reinterpit the text file so it gets updated you have to reload the text file.

it’s easy tho

reload(your scripts name here) will update your pyc file.

It gets weirder. The pivotal point seems to be event registration. Here’s a small script that effectively renders the text editor useless. Is there a more appropriate way to terminate a script?

import Blender
from Blender import Draw


print ""
print "start of script"

def gui():
    pass

def event( evt, val ):
    pass

def bevent( evt ):
    pass

Draw.Register( gui, event, bevent )
print "end of script"

what version of python are you useing?

the instructions i gave are for 2.6 and up. python changed some stuff (print being one of them) from statments to functions. in 2.6 you have to write print(“start of script”) so you might just have to use reload your script name .

thanks for the tips rdo3. I’ll definitely have to pay more careful attention to ensure my scripts run on python 2.5 and 2.6. Blame my syntax slippage. I’ve been jumping around a lot between python and ruby lately.

Reloading the script didn’t work. But, by dumb luck, I stumbled upon alt-q which actually did kill the script. Silly me. I thought hitting that little left-arrow button in the text editor would have killed it for me. I guess not.