由cx-freeze创建的exe给了我一个错误

时间:2011-08-28 05:06:30

标签: python-3.x cx-freeze

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)
        logging.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")])

所以这是我正在使用的最终代码。 EXE文件已创建但我在运行时遇到错误。错误是“Nonetype对象没有属性类型'write'”

等你回复。

1 个答案:

答案 0 :(得分:1)

如果没有堆栈跟踪,我只能建议您尝试使用base =“Console”。