title: multiprocessing with a Pool in python?
body: <p>I'm writing a small application with a Tkinter GUI to interact with an existing executable that does not have a GUI. The executable can export Solid Edge files to different formats (to PDF for example.) (see Solid Edge Translation services on the www). The goal is to export files in batch to PDF.</p>
  <p>So the part of the code that calls the executable is here. I need multiprocessing because running the executable takes a while and it would make my app not responsive.</p>
  <pre><code>    for cmd in commands: 
          print(f'running cmd {cmd}')
          p = Process(target=exportSingleFile, args=(cmd,))
          p.start()
  </code></pre>
  <p>(commands = list of commands (as strings) with arguments for input and output file and output filetype (pdf) ). Something like this:</p>
  <pre><code>&quot;C:/Program Files/Solid Edge ST9/Program/SolidEdgeTranslationServices.exe&quot; -i=&quot;input file&quot; -o=&quot;output file&quot; -t=pdf&quot;
  </code></pre>
  <p>But when I try to replace it with this, it seems my app becomes unresponsive and nothing really happens. I guess it's better to use a pool when exporting potentially dozens of files.</p>
  <pre><code>    exportResult = []
      with Pool() as pool:
          exportResult = pool.imap_unordered(exportSingleFile,commands)
      for r in exportResult: 
          print (r)
  </code></pre>
  <p>This is what &quot;exportsinglefile&quot; does</p>
  <pre><code>def exportSingleFile(cmd):
      return subprocess.run(cmd, shell=True)
  </code></pre>