2011-08-28 110 views
1

Log.pyEXE給了我一個錯誤

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對象沒有屬性類型'寫'」

等待您的回覆。

+0

回溯會很好。 –

回答

1

沒有堆棧跟蹤,我只能建議你嘗試base =「Console」。