mirror of
https://github.com/nicolabs/nicobot.git
synced 2025-09-06 03:04:48 +02:00
+ returns the status as a dict for simpler usage from other Python programs
This commit is contained in:
parent
207ff6c394
commit
707a881931
|
@ -191,6 +191,8 @@ def run( args=sys.argv[1:] ):
|
|||
# NOTE ensure_ascii=False + encode('utf-8').decode() is not mandatory but allows printing plain UTF-8 strings rather than \u... or \x...
|
||||
# NOTE default=repr is mandatory because some objects in the args are not serializable
|
||||
print( json.dumps(status,skipkeys=True,ensure_ascii=False,default=repr).encode('utf-8').decode(), file=sys.stdout, flush=True )
|
||||
# Still returns the full status for simpler handling in Python
|
||||
return status
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -694,6 +694,8 @@ def run( args=sys.argv[1:] ):
|
|||
# NOTE ensure_ascii=False + encode('utf-8').decode() is not mandatory but allows printing plain UTF-8 strings rather than \u... or \x...
|
||||
# NOTE default=repr is mandatory because some objects in the args are not serializable
|
||||
print( json.dumps(status,skipkeys=True,ensure_ascii=False,default=repr).encode('utf-8').decode(), file=sys.stdout, flush=True )
|
||||
# Still returns the full status for simpler handling in Python
|
||||
return status
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue