IDE: crashes on rerun when using logging module

Asked by Beth Griffin

I am developing a test infrastructure and want a library to setup logging to a file.
In Sikuli, I created a script with the code below. Every time I run it, the specified log file
gets updated, but the Sikuli IDE goes away.

Am I doing something wrong, or is this a bug?

# Module to set up logging and reporting
import os
import logging

TestLog = 0

def setupLogging(path, debug = 0):
 global TestLog

 if debug:
  levelLog = logging.DEBUG
 else:
  levelLog = logging.INFO
 logging.basicConfig(filename=path,level=levelLog)
 TestLog = logging.getLogger()

if __name__ == "__main__":
 setupLogging("C:\\Users\\bgriffin.AMD\\TestLog", debug=1)

 TestLog.error("Test Error Log")
 TestLog.warning("Test Warning Log")
 TestLog.info("Test Info Log")
 TestLog.debug("Test Debug Log")

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Beth Griffin (beth-griffin) said :
#1

FYI, if I import this into a different script and run that (in Sikuli IDE), there are not problems, only when I run this script as main.

Revision history for this message
RaiMan (raimund-hocke) said :
#2

This is a bug.