Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Bug Suspicion, yet to prove it..
-
Once I start massive code mods with large copy/pastes from working code in other scripts, I am finding that I am getting spurious errors like the non existence of an attribute or node that was previously fine and now despite the original code being present on the screen is no longer being seen by the interpreter.
Is anyone else seeing this issue?
I get that my coding skills are way below par but the introduction of weird errors, is not helping my confidence!
-
Are you talking about autocomplete? Or interpreter (errors)
With python a common problem is indenting to the wrong level, which might put your def at the wrong scope. Check the indentation leading up to the code.
-
It appears to be a timing or memory issue, not sure which yet
I am getting an error for example that states that I have not set the time.label which is used in update.I can resolve this simply by moving the time.label line in setup towards the top and the interpreter then complains that it is missing a line further down in setup. If I move this up it then complains about something else.
Is it possible to let setup complete before update starts?
-
I think that it is a known problem. Comment out update or delay the update by few seconds and see where the problem is.
https://forum.omz-software.com/topic/3479/why-does-is-there-an-error-ocurring-in-my-script -
May be you could add this line at the beginning of update to delay update by 10 seconds.
if self.t < 10: return
-
just set a flag at the end of setup.
are you doing a lot of heavy lifting in setup? Do what you can in
__init__
, setup is specifically for setting up the scene elements.if you have a minimal example that demos this behavior, would be useful.
-
Turns out that the issue is that the interpreter hands out random errors, when a real error exists, but update has tried starting up and resulting timing issue is apparently the cause of the random errors. I was moving the missing attribute setup up in the setup code, and not fixing the hidden code issues.
The best advice was to comment out update and track down the actual errors.
Which turned out to be COLS & ROWS set up at the top of the script, were ignored and set up as a local variable in my def Paint_Photos(self) code
My solution was to declare them as global, still not clear why COLS & ROWS worked in the game example but not in my code! Thinking I should have passed ROWS and COLS to Paint_Photos
Thanks folks, I could not have made progress without the TLC of @JonB & @enceladus
(Truly Learned Coding!)Btw delaying update simply changed the random errors??!!