Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recurse on windows #140

Open
madpipeline opened this issue Aug 11, 2017 · 1 comment
Open

Infinite recurse on windows #140

madpipeline opened this issue Aug 11, 2017 · 1 comment

Comments

@madpipeline
Copy link

When running on Windows, with init(convert=True) I get this.
Tested on Windows 8.1 and Windows 10.
When used on Linux, I get no colors.

Traceback (most recent call last):
File "C:\jenkins\workspace\main.py", line 77, in <module>
  ts.append(testSuite.runTestSuite())
File "C:\jenkins\workspace\TTP_TestSuite.py", line 67, in runTestSuite
  currentTest.runTest()
File "C:\jenkins\workspace\TTP_Test.py", line 201, in runTest
  self.output.info("Running test: %s" % self.name, 1)
File "C:\jenkins\workspace\output.py", line 29, in info
  self.writeln(data, verbose, front=(Style.BRIGHT +  Fore.CYAN))
File "C:\jenkins\workspace\output.py", line 18, in writeln
  self.write(data, verbose, front, error, True)
File "C:\jenkins\workspace\output.py", line 26, in write
  print(data, end=end, file=out)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 40, in write
  self.__convertor.write(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 141, in write
  self.write_and_convert(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 166, in write_and_convert
  self.write_plain_text(text, cursor, start)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
  self.wrapped.write(text[start:end])
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 40, in write
  self.__convertor.write(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 141, in write
  self.write_and_convert(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
  self.write_plain_text(text, cursor, len(text))
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
  self.wrapped.write(text[start:end])
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 40, in write
  self.__convertor.write(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 141, in write
  self.write_and_convert(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 169, in write_and_convert
  self.write_plain_text(text, cursor, len(text))
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 174, in write_plain_text
  self.wrapped.write(text[start:end])
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 40, in write
  self.__convertor.write(text)
File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 141, in write

...

File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 40, in write
    self.__convertor.write(text)
  File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 141, in write
    self.write_and_convert(text)
  File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 163, in write_and_convert
    text = self.convert_osc(text)
  File "C:\Program Files\Python36\lib\site-packages\colorama\ansitowin32.py", line 225, in convert_osc
    for match in self.ANSI_OSC_RE.finditer(text):
RecursionError: maximum recursion depth exceeded while calling a Python object

The code that produces this is basically this (minus the functions that get to this end result):

from colorama import init, Fore, Style
init(convert=True)

def write(self, data, verbose=0, front=None, error=False, newLine=False):
    if front:
        data = "%s%s%s" % (front, data, Style.RESET_ALL)
    end = "" if newLine == False else "\n"
    out = sys.stderr if error else sys.stdout
    print(data, end=end, file=out)
@madpipeline
Copy link
Author

Without init(convert=True) I see the ANSI codes, and get no colors on windows 10. On windows 8.1 the colors show as they should, as on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant