tymonr icon

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

tymonr | PRO | 02/25/20 05:30:25 PM UTC | 0 ⭐ | 340 👁️ | Never ⏰ | []
Python |

330 B

|

None

|

0 👍

/

0 👎

import subprocess
import os
 
def tolist(folder):
    #subprocess have to print output in stdout
    output = subprocess.run(['python', './dev-utils/files_to_list.py', folder, '.json'], stdout=subprocess.PIPE)
    with open(os.path.join(folder, 'list.json'), 'w') as text_file:
        text_file.write(output.stdout.decode('utf-8'))

Comments