diff --git a/scripts/supybot b/scripts/supybot index 038b41413..4b2bfe93c 100644 --- a/scripts/supybot +++ b/scripts/supybot @@ -44,6 +44,7 @@ import shutil import signal if sys.version_info[0] < 3: import cStringIO as StringIO + StringIO = StringIO.StringIO else: from io import StringIO @@ -273,8 +274,8 @@ if __name__ == '__main__': # level WARNING on upkeep. sys.stdout.close() sys.stderr.close() - sys.stdout = StringIO.StringIO() - sys.stderr = StringIO.StringIO() + sys.stdout = StringIO() + sys.stderr = StringIO() # We have to be really methodical here. os.close(0) os.close(1) diff --git a/src/world.py b/src/world.py index 980e95783..4be6173d3 100644 --- a/src/world.py +++ b/src/world.py @@ -149,6 +149,8 @@ def upkeep(): except IOError: # Win98 sux0rs! pass if conf.daemonized: + if sys.version_info[0] >= 3: + from io import TextIOWrapper as file # If we're daemonized, sys.stdout has been replaced with a StringIO # object, so let's see if anything's been printed, and if so, let's # log.warning it (things shouldn't be printed, and we're more likely