Search code examples
pythonscriptingoperating-systemsubprocessdataset

executing a python script within another python script


I wanted to run this script that saves images generated by a TDW script but the TDW script is definitely not running.

import glob
import os
import cv2
import subprocess
i = 0
frameSize = (512, 512)
path = 'CRIPP/annotations/icqa_dataset/IID/json'
for i in range(0, 1):
    new_path = path + f'/example_{i}.json'
    cmd = "recreate.py -json={new_path}"
    os.system(cmd)
    #subprocess.call(['recreate.py', '-json='+new_path])

Solution

  • I think you forgot to run script using python. Change cmd line to cmd = "python recreate.py -json={new_path}"