Page 1 of 1

Report on Phyton scripting I used

PostPosted: Sun Jan 21, 2018 10:37 am
by Turribeach
Over the years I have done several Phython scripting solutions embedded and on files. I find it hard sometimes to remember where things are so I want to move all scripting to files and document it in such a way that I know what is calling each script. Is there any way to programatically report where scripting is used in triggers/action groups/etc, embedded or in a file? What do people do to keep track of which scripts are being called by what object?

Thanks!

Re: Report on Phyton scripting I used

PostPosted: Sun Jan 21, 2018 5:11 pm
by DaveL17
Personally, I run my scripts as embedded scripts where ever possible and keep all of the scripts in one folder. I don't log each script when it's executed but I do want to know when something has gone wrong and where the error came from. So within each script I include an except block with the following construct:

Code: Select all
except ValueError as error:
    indigo.server.log(u"ValueError: {0}".format(error), isError=True, type="script_name.py")

So when an error crops up, the error message will include "script_name" so I know where to look.