I am trying to write a simple code generator to play part of a csound file but I am writing zero byte files out to the disk. It appears the filename is coming through o.k.
https://sourceforge.net/projects/dex-tracker/
Code:
import sys as sys2
import os as os2
def playscoreinrange(from_file, fromline, toline):
"untested way to play a series of lines from a orc, sco combination line 14 may not be correct"
print(from_file)
fromfile = os2.path.basename(from_file)
infile = open(fromfile, 'r')
outfile = open('temp.sco','w')
orcfilename = fromfile[:-4] + '.orc'
infile2 = open(orcfilename, 'r')
outfile2 = open('temp.orc', 'w')
for line in infile2:
outfile2.write(line)
data = sys2.stdin.readlines()
for linenumber in range(fromline, toline):
outfile.writeline(data[linenumber])
os2.startfile('temp.bat')
Comment