Cheers Jeff - you're a star! I have got another problem though - all of a sudden the output data will not write to the specified file - it was fine and then suddenly stopped working. The code I have is as follows:
Code:
directory = 'Y:\backup\Vizard30\resources\road'
subjectd = 'speed_.txt' + str(subject)
filename = directory+subjectd
file = open(filename, 'w')
def mytimer (num):
out = (str(round(speedm,1)) + '\n')
file.write(out)
file.flush()
print out
viz.callback( viz.TIMER_EVENT, mytimer )
viz.starttimer( 0, 0.25, viz.FOREVER )
but now this message appears:
Traceback (most recent call last):
File "<string>", line 11, in ?
File "roadldstop.py", line 167, in ?
file = open(filename, 'w')
IOError: [Errno 2] No such file or directory: 'Y:\x08ackup\\Vizard30\resources\roadspeed_.txt222 2'
I know the path exists so is this message because it's trying to create a temporary file when outputting the data?