Neil,
While UniVerse (and equally UniData) have direct control of their input and output data streams so can duplicate output to COMO files, Python is independent and does not have access to UniVerse file handles. It is also a separate language environment and does not have what one might call 'COMO awareness- - which is U2 database specific.
To log in Python an appropriate PYTHON logging library should be used, and the logging location and file naming conventions would be determined by the developer. It would certainly be possible to write to &COMO&, though you should be aware that this directory structure is created by UniVerse on demand and you would need to cater for it not existing.
An example using the PYTHON 'logging' module:
UniVerse Command Language 11.3
Copyright Rocket Software, Inc. or its affiliates, All Rights Reserved 1985-2021
XDEMO logged on: Thu Dec 23 12:32:51 2021
Welcome to the XDEMO Account
Version: 3.1.5
>PYTHON
python> import logging
python> logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
python> logging.debug('This message should go to the log file')
python> logging.info('as should this,')
python> logging.warning('and this too.')
python> logging.error('As indeed should this.')
python> exit
>LO
C:\U2\UV\XDEMO>type example.log
DEBUG:root:This message should go to the log file
INFO:root:As should this,
WARNING:root:and this, too.
ERROR:root:As indeed should this.
C:\U2\UV\XDEMO>
Here is useful online article I found that you may find useful:
https://docs.python-guide.org/writing/logging/------------------------------
John Jenkins
Principal Technical Support Engineer
Rocket Software Limited
U.K.
------------------------------
Original Message:
Sent: 12-22-2021 11:40
From: Neil Sherwood
Subject: Using the COMO with python
I've noticed that output from my python routines that are called from universe programs doesn't go into the COMO whilst any output from the universe program does. Anyone noticed this, found an easy way round it?
------------------------------
Neil Sherwood
Analyst Programmer
HSBC Global Services (UK) Limited
London GB
------------------------------