Skip to main content

Posts

Showing posts from March, 2020

subprocess

Python subprocess running ffmpeg in the python subprocess if there is some error .. mark the shell=True process = subprocess.Popen( command , stdout =subprocess.PIPE , shell = True )

example of threading in python

# Python program to illustrate the concept # of threading import threading import os def task1 (): print ( "Task 1 assigned to thread: {}" .format(threading.current_thread().name)) print ( "ID of process running task 1: {}" .format(os.getpid())) for i in range ( 200 ): print ( "task1 : " + str (i)) def task2 (): print ( "Task 2 assigned to thread: {}" .format(threading.current_thread().name)) print ( "ID of process running task 2: {}" .format(os.getpid())) for i in range ( 200 ): print ( "task2 : " + str (i)) if __name__ == "__main__" : # print ID of current process print ( "ID of process running main program: {}" .format(os.getpid())) # print name of main thread print ( "Main thread name: {}" .format(threading.main_thread().name)) # creating threads t1 = threa