Hello Folks,
I encountered this error that appears to be quite common (A search on the forum yields several results), however none of the other threads seem to address this particular case.
The problem is already fixed (though I changed nothing), but since I have no idea what went wrong I thought I'd ask in case it happens again.
Here goes:
I have a gateway event scheduled script that sends out a daily summary of alarms.
All of the code is in a project script, all that's in the gateway script itself is this:
def onScheduledEvent():
logger = system.util.getLogger("alarmSummaryScript")
try:
# AlarmSummary.summary.send_summary(site="foo", test=True)
AlarmSummary.summary.send_summary(site="foo", customer="bar")
except BaseException as e:
logger.error(repr(e))
And here's the error:
NameError("global name 'AlarmSummary' is not defined",)
Now, I have 5 sites using this, never had any issue with it, and only ONE of those started misbehaving 2 weeks ago (I just came back from holidays).
All I did was use the test call that's commented in the snippet above, which makes it send the mail to me instead of the customers. It worked, so I put back the original line, and it also worked. Nothing changed.
Now, nothing changed on this site's project the day it stopped working, BUT I am in the process of reworking/refactoring everything into a global project from which all our sites could inherit, and on that very day I did create a child of this base project, using the same site as my guinea pig. While I can't see how it could affect another project's code (which don't inherit from the new global project), that's the only thing that happened around the time the issue arose.
This is all using perspective, version 8.1.18.
I'd very much like to avoid this happening again, especially when I'm out of the office for two weeks :X
Thanks for any clue you may have !