On Sat, Jan 11, 2014 at 12:48:13PM +0800, daedae11 wrote: > p = subprocess.Popen(['E:/EntTools/360EntSignHelper.exe', > 'E:/build/temp/RemoteAssistSetup.exe'], > stdout=subprocess.PIPE, shell=True).stdout > temp = p.readline(); > print temp > p.close() > > When I run the above code in command line, it works formally.
What do you mean, "the above code"? Do you mean the *Python* code? Or do you mean calling the 360EntSignHelper.exe application from the command line? I'm going to assume you mean calling the .exe. > However, when I writed it into a .py file and execute the .py file, it > blocked at "temp=p.readline()". Of course it does. You haven't actually called the .exe file, all you have done is created a Popen instance and then grabbed a reference to it's stdout. Then you sit and wait for stdout to contain data, which it never does. Instead, you can do this: p = subprocess.Popen(['E:/EntTools/360EntSignHelper.exe', 'E:/build/temp/RemoteAssistSetup.exe'], stdout=subprocess.PIPE, shell=True) output = p.communicate()[0] print output I think that should do what you expect. -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor