Thread: Vapoursynth
View Single Post
Old 11th February 2021, 17:07   #4293  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
I got the dummy filter printing messages now, but for some reason the logging module is not catching warnings on evaluation

Code:
import logging

class MessageAbsorber(logging.Handler):
    def __init__(self, message_container):
        logging.Handler.__init__(self)
        self.messageContainer = message_container
    def emit(self, message_record):
        self.messageContainer += [message_record.getMessage()]

WarningMessages = []
logging.captureWarnings(True)
logging.getLogger('py.warnings').addHandler(MessageAbsorber(WarningMessages))

def get_warnings():
    return WarningMessages

import vapoursynth as vs

core = vs.get_core()
core2 = vs.get_core()
core3 = vs.get_core()
clip = core.dgdecodenv.DGSource(r'video.dgi')
clip.set_output()

core.vsedit.Logger(get_warnings())
The same codes worked on PyCharm, but in vseditor, I'm getting error about the WarningMessages list still being empty. It will print if I passed in a list core.vsedit.Logger(["message1", "message2"])

Update: I think the reason for this is because vs disabled the warnings so they aren't even logged.

Last edited by lansing; 12th February 2021 at 01:41. Reason: update
lansing is offline   Reply With Quote