Apologies, but without seeing this one, in action, it's pretty tough to tell you exactly what's wrong.
I can tell you that I duplicated this, ON WINDOWS, and it works fine for me, both from within the interpreter, from "python script.py" and from running the py direct from within windows explorer.
My gut tells me something still isn't quite right with your pathing, etc. I'd also be inclined to think one of your dependency libs that get included is bad, but that shouldn't affect it differently when run from commandline versus interpreter.
Only other possibility I could think of would be, do you have multiple versions of python installed, such that when calling python it's getting a different version than the interpeted version you're running? (Doubtful, as you likely just started the interpreter via the 'python' command, as well, but...)
But again, it works fine for me, regardless of where and how I run it. And again, someone hit a snag in the RedHat world, with that bugzilla entry, which threw the exact same error message as yours.
What happens if you run it using pdb:
python -m pdb script.py
Then you can step through and see if a certain step does anything unexpected. Some commands in pdb (more can be found in online docs):
b: set a breakpoint
c: continue debugging until you hit a breakpoint
s: step through the code
l: list all the variables in the current scope
u: navigate up a stack frame
d: navigate down a stack frame
You can use s, for instance, to step through, and see it load all dependencies, along the way, and try to see if something is behaving differently than expected (granted, could be a long process, but might be helpful)
~ hayabusa ~
"All men can see these tactics whereby I conquer,
but what none can see is the strategy out of which victory is evolved."
- Sun Tzu, 'The Art of War'
OSCE, OSCP (Former - GPEN, C|EH - both expiring / expired)