Hello App: hello.py
Contents
hello.py
#!/usr/bin/python3
hello.py - A sample Python program (Hello World) to demonstrate how the Python-MAE integration works.
Copyright (c) 2024 HanoverSoft
820 Churchill Drive, Chapel Hill, NC 27517
The app starting point, integrated with MAE.
# Written by Anthony V. Edwards
# ave@hanoversoft.net
import os
import sys
mae_python_path= '/usr/mae/python'
if 'MAE_PYTHON' in os.environ:
mae_python_path= os.environ['MAE_PYTHON']
import HelloApp
import HelloCache
import msgHello
from MAEApp import *
from debug import *
appname= 'hello'
if not debug_on:
MAE.toggleDebug()
print(f'hello.py init({argv}) method; debug={debug_on}')
HelloCache.cacheAlloc(appname)
print(f'{appname} main() method')
sys.stderr.write(f'{appname}: quit({msg}) method\n')
if rc:
MAETask.failed(msg)
else:
if not msg:
msg= 'Completed'
MAETask.done(msg)
if debug_on:
dbgf.write("Done!")
dbgf.close()
exit(rc)
Tell MAE how we behave and what channel we listen on.
MAEDaemon means we're always running; we don't perform a task and exit.
If we optionally listened on more channels than just hello, we'd specify
that here (as second parameter).
See module MAE and MAETask for task-specific info and more.
Calling MAETask.getName() will return "hello".
When debug mode is enabled, the dbgf variable will append /usr/mae/log/hellodbg.log.
# Admittedly, program execution will never get here