¿ªÔÆÌåÓý

Locked Running a python script in JMRI #scripting


 

Hi all

I am trying to run the following script in JMRI'

import wave
infiles = ["General01.wav", "General03.wav"]
outfile = "sounds.wav"
data= []
path = "C:/Users/tim_p/sounds/Peter/"
for infile in infiles :
??? fullpath = path + infile
??? print(fullpath)
??? w = wave.open(fullpath, 'rb')
??? data.append( [w.getparams(), w.readframes(w.getnframes())] )
??? w.close()
output = wave.open(path + outfile, 'wb')
output.setparams(data[0][0])
output.writeframes(data[0][1])
output.writeframes(data[1][1])
output.close()
print("done")

whilst it runs fine in the python idle enviroment it won't run as a script in JMRI. I am guessing the wave library does not exist in JMRI.

how do i solve this?

many thanks
Tim

Join [email protected] to automatically receive all group messages.