Python 3 |如何一次运行2个进程?

时间:2019-04-11 19:26:03

标签: python python-3.x multithreading operating-system os.system

我正在尝试在Python3中构建工具。我想同时运行命令并更新进度条。

 def bulkextractor_run(self):

         #command im trying to run
        print("File Path to file", "\"" + diskimage + "\"")
        p1 = Thread(target=BulkExtractor().update())
        p2 = Thread(target=os.system("%Programdata%\\bulk_extractor64.exe -o %Programdata%\\output ""\"" + diskimage + "\""))

        p1.start()
        p2.start()
#Updates progress bar       
    def update(self):
        for i in range(101):
              time.sleep(0.1)
              print(i)
              Clock.schedule_once(partial(self.update_progressBar, i))

我试图使用多线程来同时运行这两种方法,但是不幸的是,它没有工作,并且继续一次运行一行代码。

我也尝试过使用多处理,但似乎无法弄清楚自己在做什么错。

有人可以帮忙吗?

谢谢

0 个答案:

没有答案
相关问题