Windows - running .py directly vs running python blah.py behaves differently
Question: I have a python script that uses subprocess:

    
    
    import subprocess
    print "Running stuff"
    subprocess.check_call(["do_stuff.bat"])
    print "Stuff run"
    

If this was named blah.py, and I run (from a command prompt):

    
    
    python blah.py
    

I will get the output from do_stuff.bat (or whatever I run).

If this is run as:

    
    
    blah.py
    

Then I do not get output from do_stuff.bat, only the print statements.

So far seen on windows Server 2003. Python version 2.5.2 (stuck there for
various reasons). Looking at the associated file type action I see:

Python.File="C:\Python25\python.exe" "%1" %*

So can anyone explain the difference?


Answer: I had common problem using threads, but all of my code was in python. Threads
can not write to standard output using print. Just main thread could do that.
I used somethnig like this

    
    
    import sys
    sys.stdout.write("this was printed by thread")
    

I know that probably it wont help you with bat file...

