Same code works in "editpythonscript", but not "scripteditor"

What I meant was when I run it in ‘scripteditor’ with ironpython2 it still didn’t work. And like what you suggested, I did adjust it to meet python3 format and it run without errors. It just didn’t work…The only case it worked is to run it with “editpythonscripts”.