0
정보가있는 로그 파일을 순서대로 생성하려고합니다.파이썬에서 서브 프로세스를 사용할 때 FileIO의 순서가 잘못되었습니다.
class ExecThread(threading.Thread):
def __init__(self, command):
self.command = command
self._lock = threading.Lock()
threading.Thread.__init__ (self)
def run (self):
self._lock.acquire()
sys.stdout.write(''.join(["Executing: ",self.command,'\n']))
log_file.write(''.join([self.command,'\n']))
os.system(self.command)
self._lock.release()
for ive in locate('*.ive', root_dir):
command = "osgconv"
command = ''.join([command,' ',"-O OutputTextureFiles",' ', infile,' ', outfile,' ',"2>&1"])
conv_osg_thread = ExecThread(command)
conv_osg_thread.start()
conv_osg_thread.join()
내가 실행하고 명령은 끝이 리디렉션이 있습니다 : 이것은 내가 무엇을 가지고 "2> & 1" 나는이 프로그램을 실행할 때 나는 "어쩌구 실행"메시지 전에 서브 프로세스의 출력을 얻을 , 그것은 첫째로 열거되다! 나는 자물쇠()가 그것을 고칠 것이라고 생각했지만, 아니.
제 실수를 지적 할 수 있다면 도와 주시면 감사하겠습니다.
감사합니다. 그것은 쉽다. – Gareth