Colorama AssertionError in Python 3.2
我最近开始使用python 3.2,以前从未尝试过编程。我将colorama文件夹复制到c:python32lib中的lib目录,然后在尝试基于文本的冒险游戏时生成以下代码:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | import colorama from colorama import Fore, Back, Style colorama.init() notedaction ="You have gained a SWORD AND SHIELD!" uniqueskill ="strength" if 'strength' in uniqueskill.lower(): time.sleep(3) print('As you are a Warrior, I shall supply you with the most basic tools every Warrior needs.') time.sleep(3) print('A sword and shield.') time.sleep(1) print(Fore.RED + notedaction) |
但是,每当我到达代码的这一部分时,就会出现以下错误:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | File"<pyshell#10>", line 7, in <module> print(Fore.RED + notedaction) File"C:\Python32\lib\colorama\ansitowin32.py", line 34, in write self.__convertor.write(text) File"C:\Python32\lib\colorama\ansitowin32.py", line 115, in write self.write_and_convert(text) File"C:\Python32\lib\colorama\ansitowin32.py", line 140, in write_and_convert self.convert_ansi(*match.groups()) File"C:\Python32\lib\colorama\ansitowin32.py", line 154, in convert_ansi self.call_win32(command, params) File"C:\Python32\lib\colorama\ansitowin32.py", line 175, in call_win32 func(*args, **kwargs) File"C:\Python32\lib\colorama\winterm.py", line 48, in fore self.set_console(on_stderr=on_stderr) File"C:\Python32\lib\colorama\winterm.py", line 68, in set_console win32.SetConsoleTextAttribute(handle, attrs) File"C:\Python32\lib\colorama\win32.py", line 66, in SetConsoleTextAttribute assert success AssertionError |
号
有什么问题吗?
这似乎是一个问题:在真实的python解释器中进行空闲测试时,colorama 0.1.18。