Noob: Trying to run two python scrips on a pfsense/freeBSD for the OWL-Intuition-LC

wrw at mac.com wrw at mac.com
Tue Jan 1 22:18:42 EST 2013


On Jan 1, 2013, at 9:42 PM, vbhoj74 at gmail.com wrote:

> Hi,
> 
> I wrote couple of scrips to work with OWL-intution-LC home/office electricity monitor. The concept of the first scrip (owl.py) to capture network multicast from the OWL gateway and write to a .csv file has been taken from a raspberrypi forum and further developed upon to work with sqlite. The second scrip (responder.py)keeps checking a mail account for any email queries received and responds with a detailed electricity report to the sender. 
> 
> I've been using owl.py since some days & works fine on the pfsense/freebsd, it has been set to start on boot using shellcmd. The second scrip also works when I execute manually from the shell, but it does not seems to start upon boot how I did for owl.py. I cannot find anything in /var/log/system.log about execution or failure of either scrips.
> 
> This question may not exactly relate with python but any help would be appreciated.
> 
> Another Q I wanted to ask or rather confirm, I think python does not log anything from scrip runtime/termination and that there is a log library that needs to be used. I find using the log library adding bulk to the code and for every line I suspect of failure in the code I would need to put in an exception to create log ? Is there a better way of logging where it just logs the reason on scrip termination ? I just want to log the msg it shows when manually run in a shell. - Thanks.
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Can't help with the mail script's failure to launch (although it may be because something in the script requires an environmental variable that hasn't been created when running in batch).  But I can make a suggestion for logging.  Operating systems have subtle differences, so this may not be a solution for you, but at least on OS-X (which at its heart is an amalgam of freebsd and netbsd), any print statement goes to the system log if the program is being run from batch rather than from an interactive terminal window.  Thus, simple print statements scattered through the code should allow you to monitor the execution under normal circumstances.  Of course, any abnormal termination will result in error messages in the same system log.

-Bill



More information about the Python-list mailing list