# ConsoleOutput.py
i tried to change a little bit your code so it doesn't open and close output file every single line it writes
and can be opened with "wt" which would automatically accomplish removing old entries and not grow console.log to monstrous size
but well:
--- console:
(...)
G:\gamez\Blade of Darkness\bin
G:\gamez\Blade of Darkness\Maps\Casa
B_App::RunScriptFile() -> Error ejecutando Cfg.py
Start optimizing Astar...OK!
--- EOF console
and messagebox with "Player1 not declared in pj.py"
so it doesn't work, sorry I don't get python that well
--- cut Lib/ConsoleOutput.py ---
Code: Select all
#import Bladex
import Console
import sys
#import os
DEBUG_FILE = 1
class ConsoleOutput:
softspace=0
if DEBUG_FILE:
if not dbg:
dbg=open("console.log","at")
def write(self,message):
if message is None:
Console.ConsoleOutput("None")
else:
if DEBUG_FILE:
# dbg=open("Debug.txt","at")
dbg.write (message)
dbg.flush()
# dbg.close()
## if DEBUG_FILE:
Console.ConsoleOutput(message)
def flush(self):
pass
def InitConsole():
ConsoleOut=ConsoleOutput()
if DEBUG_FILE:
dbg=open("console.log","at")
## if DEBUG_FILE:
sys.stderr=sys.stdout=ConsoleOut
--- EOF cut Lib/ConsoleOutput.py ---