开发者

exe created by cx-freeze gives me a error

开发者 https://www.devze.com 2023-03-31 11:53 出处:网络
Log.py import logging import logging.handlers class Log: def __init__(self): FILENAME=\'LOG\' logging.basicConfig(level=logging.INFO)

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消