Need a non-crashing "endless" loop
Posted: Fri Dec 15, 2006 11:14 pm
*UPDATE: first problems solved - work work!
Hi all,
Now that 2.5 is final (great job!), I'm off to start working on my modules again.
The module I'm currently working on reads a string out of a text file, the problem is that the string in the text file changes continuously (externally generated X-Y-Z coords) and I want to read the file continuously too or let's say at a given framerate (24fps) so I can use the externally generated coords in realtime (fe. using the coords to rotate a modul8 generated cube)
I've been trying to do it with while/for loops but as there's no end to the loop, modul8 crashes. It's probably something with a periodical event but I have no idea how to do it.
I'm using:
Help seriously appreciated and thanks in advance
Thanks,
Kevin
Hi all,
Now that 2.5 is final (great job!), I'm off to start working on my modules again.
The module I'm currently working on reads a string out of a text file, the problem is that the string in the text file changes continuously (externally generated X-Y-Z coords) and I want to read the file continuously too or let's say at a given framerate (24fps) so I can use the externally generated coords in realtime (fe. using the coords to rotate a modul8 generated cube)
I've been trying to do it with while/for loops but as there's no end to the loop, modul8 crashes. It's probably something with a periodical event but I have no idea how to do it.
I'm using:
Code: Select all
//init
file = open('textfile.txt', 'r') //opening the file
txt = file.readline() //reading the first and only line
txt = txt.split(';') //splitting the string as the coords are divided by ';'
print txt //console print for checkup
k = 'testvar'
// I tried things like
while k == 'testvar': //which it always is, so it'll continuously do the following
file.close()
file = open('textfile.txt', 'r') //opening the file
txt = file.readline() //reading the first and only line
txt = txt.split(';') //splitting the string as the coords are divided by ';'
print txt //console print for checkup
//but quite logically it crashes
Help seriously appreciated and thanks in advance
Thanks,
Kevin