Log.py
import logging
import logging.handlers
class Log:
def __init__(self):
FILENAME='LOG'
logging.basicConfig(level=logging.INFO)
root_logger = logging.getLogger('')
logger = logging.handlers.TimedRotatingFileHandler(FILENAME,'midnight',1)
root_logger.addHandler(logger)
log开发者_StackOverflow社区ging.getLogger('log')
Main.py
from Log import Log
import time
import logging
log_obj = Log()
log = logging.getLogger('log')
log.info("Service Started")
while 1:
t=1
setup.py
from cx_Freeze import setup, Executable
setup(
name = "Test",
version = "0.1",
description = "Test",
executables = [Executable("Main.py", base="Win32GUI")])
So this is the final code which I am using. EXE file got created but I am getting an error while running it.The error is "Nonetype object has no attribute type 'write'"
Waiting for you reply.
Without a stack trace, i can only advise you to try base="Console".
精彩评论