2014-09-01 3 views
1

뷰어에서 이미지를 표시하기 위해 생성 된 서브 프로세스를 실제로 죽이는 문제가 있습니다. 기본적으로 스택에서 사진을 열어 특정 시간 동안 표시 한 다음 하위 프로세스를 종료하려고합니다. 프로그램을 실행하면 원하는대로 사진이 표시되지만 실제로 작동하려면 .kill 또는 .terminate 기능을 사용할 수 없습니다.파이썬 서브 프로세스가 종료되지 않음

class ImageDisplay(ThreadParent): 
    def __init__(self, label): 
     ThreadParent.__init__(self, label) 
    def display_image(self): 
     image = ThreadParent.image_stack.pop(0) 
     cwd = os.getcwd() 
     # Automagically opens in preview @ osx 
     p = subprocess.Popen(["open", "file://%s/%s" % (cwd, 
      filepath(filename(image)))]) 
     disptime = displaytime(image) 
     print("Displaying image:", image, "for", disptime, "seconds..") 
     time.sleep(disptime) 
     p.terminate() 
     p.kill() 

모든 도움을 주실 수 있습니다.

모든 나는 open 프리뷰 미리보기 프로그램에는 핸들이없는 의미하는 열린 후 종료됩니다 생각하는 최고의

답변

1

.

/Applications/Preview.app/Contents/MacOS/Preview /path/to/image.jpg 

HTH

: 대신 같은 미리 바이너리를 호출 시도
관련 문제