tymonr

python-file-call-another-python-file.py

Feb 25th, 2020
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. import subprocess
  2. import os
  3.  
  4. def tolist(folder):
  5.     #subprocess have to print output in stdout
  6.     output = subprocess.run(['python', './dev-utils/files_to_list.py', folder, '.json'], stdout=subprocess.PIPE)
  7.     with open(os.path.join(folder, 'list.json'), 'w') as text_file:
  8.         text_file.write(output.stdout.decode('utf-8'))
Advertisement
Add Comment
Please, Sign In to add comment