title: Output not getting printed in external text file
body: <p>enter code here I want to get the output of the following code in an external text file. I am able to create a text file but the data of the console is not getting printed into the text file. Snippet of my code below:</p>
  
  <pre class="lang-py prettyprint-override"><code>import subprocess
  import os
  from concurrent.futures import  ThreadPoolExecutor
  
  print('maximum no of runs is 4')
  
  number=int(input('enter your choice:'))
  
  if number&lt;=4:
  
          num=int(number)
          def sally():
              os.chdir(r"C:\Program Files\xxxx")
              subprocess.Popen(r"C:\Program Files\xxx\yy.exe")
              os.system('cmd /k "xxxxxx"')
  
          with ThreadPoolExecutor(max_workers=6) as e
              total_runs=num
              for i in range(total_runs):
                  e.submit(sally)
                  i=i+1
  else:
      print('your choice is exceeding')
  </code></pre>
  
  <p>The code which i am trying to get the output stored in an external text file is :</p>
  
  <pre class="lang-py prettyprint-override"><code>
  import subprocess  
  import os  
  from concurrent.futures import ThreadPoolExecutor  
  
  if number &lt;= 4:  
  
      num = int(number)
      def sally():
          os.chdir(r"C:\Program Files\xxxx")
  
      with ThreadPoolExecutor(max_workers=8) as e:
              total_runs = num
              for i in range(total_runs):
                  output=subprocess.run([r"C:\Program Files\xxxx\xx.exe", 'b'])
                  e.submit(sally)
                  i = i + 1  
  
      log_file = open('testccc.txt', 'w')
      log_file.write(output)
  
  
  for this i am getting below error:
  
     log_file = open('testccc.txt', 'w')
  x64 6.4E03 cpus:4 128T f:110C2774C
  Permission Error: [Errno 13] Permission denied: 'testccc.txt' 
  
  
  
  not sure if what i have written is correct or not or i have missed something which i am not able to figure it out. Can anyone help me with this
  </code></pre>