Console not updating anymore for debugging
On 29/04/2015 at 08:02, xxxxxxxx wrote:
This is an odd one.
Until just recently I would use the console to display data while executing a python generator script. I would have some loops with intensive cpu work going on - and I would update the console with some print commands to show where in the loop it is, and print other useful data. This would show me in realtime how the script is progressing as it's being executed.
But for some reason this has suddenly stopped. I now only get the print out of data in one lump sum after the script has completed, and not during execution. I can't remember changing any settings, or changing anything in my code that would cause it. Totally dumbfounded. Any help appreciated, thanks,
On 29/04/2015 at 08:24, xxxxxxxx wrote:
just a wild guess...
Did you try to open a new scene with a new generator object and copy/paste the code.
A few days ago I had some issues with a generator, too and a new scene solved it.
On 29/04/2015 at 08:57, xxxxxxxx wrote:
Na, just tried that Martin - copied everything into a new scene file, created new generator.. no luck. strange one..
On 29/04/2015 at 11:10, xxxxxxxx wrote:
where is your print statement placed?
Is it after you return the cache? Did you handle the cache optimization by yourself?
A snippet will help to dive into.
On 29/04/2015 at 11:38, xxxxxxxx wrote:
just found the source of the problem - it's to do with the EventAdd lines I have in my code. Below I've recreated the problem - 'hit' is printed after the code has completely executed. Take out the eventadd line and it's printed half way through as expected.
#Welcome to the world of Python
c = 0
for x in xrange(1000000) :
cube = c4d.BaseObject(c4d.Ocube)
if c==50000: print 'hit'
c += 1
def main() :
On 30/04/2015 at 07:42, xxxxxxxx wrote:
calling EventAdd() inside the loop does not make sense. This function adds an event to an event queue that is evaluated after your code is left. Also adding multiple events will result in only one update.
If the presence of EventAdd() influences the work of "print" it might be a bug. We will investigate.
On 30/04/2015 at 08:36, xxxxxxxx wrote:
In my actual program (not the example above) the eventadd wasn't inside the loop - it was in the root level of the script after the loop had finished, but was still causing the problem. I needed the eventadd to update my scene after materials where added to objects. Anyway, I got around all this and things are working okay without eventadd anywhere, cheers.