Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

I can't do multiple os.system() commands. What am I missing?

def separateSegments():
    sound_file = pydub.AudioSegment.from_wav("SSTV-Complete-Transmission.wav")
    sound_file_Value = np.array(sound_file.get_array_of_samples())
    # milliseconds in the sound track
    # * 4.88
    ranges = [(0,1805600),(1805600,3625800),(3625800,5494800),(5494800,7300400),(7300400,9106000)]

    #print(str(ranges))

    for x, y in ranges:
        new_file=sound_file_Value[x : y]
        song = pydub.AudioSegment(new_file.tobytes(), frame_rate=sound_file.frame_rate,sample_width=sound_file.sample_width,channels=1)
        song.export("AMEA_Transmission_" + str(x) + "-" + str(y) +".wav", format="wav")

def processSegments():
    os.system('''cmd /k "sstv -d AMEA_Transmission_0-1805600.wav -o AMEA_Data_Result_0-1805600.png"''')
    jeff = 1
    os.system('''cmd /k "sstv -d AMEA_Transmission_1805600-3625800.wav -o AMEA_Data_Result_1805600-3625800.png"''')

I’m trying to run multiple os.system commands that uses a command prompt command from https://github.com/colaclanth/sstv. For whatever reason, it only runs the first and ignores the second. Is there a way for it to run multiple commands?

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

cmd /k ... means "run the following command, then remain open". You’re running the first os.system call, but since cmd does not terminate, the call never returns, and the program doesn’t advance to the next line.

You probably want the /c option instead of /k. That means "run the following command, then terminate".

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading