daiquiri icon indicating copy to clipboard operation
daiquiri copied to clipboard

ANSI escape character sequences are printed in Windows cmd.exe when outputting to stderr

Open lpinner opened this issue 7 years ago • 4 comments

I'm stuck using Windows :(for work).

The ANSI escape character sequences are printed in Windows cmd.exe when outputting to stderr.

#test.py
import daiquiri
daiquiri.setup()
logger = daiquiri.getLogger()
logger.error("something went wrong")

test I can workaround using colorama (the library that IPython uses).

#test_colour.py
import colorama 
colorama.init()

import daiquiri
daiquiri.setup()
logger = daiquiri.getLogger()
logger.error("something went wrong")

test_colour

Colours also work when script is run using ipython as colorama is being used automatically (i.e. ipython test.py).

Is there a way to tell daiquiri not to output colour escape chars?
Even better ; ), would you consider using colorama as an optional extra?

lpinner avatar Jul 10 '17 03:07 lpinner

Oh we should definitely switch to colorama. @blakev maybe you should take a look into that for https://github.com/jd/daiquiri/pull/9 ?

jd avatar Jul 10 '17 13:07 jd

For sure, if you're not against adding the dependency.

blakev avatar Jul 10 '17 14:07 blakev

No, all good for me. Worst thing we could make it optional, but well. It's a common use case.

jd avatar Jul 10 '17 14:07 jd

Once colorama is used, you can document that Windows is supported in setup.cfg.

eli-b avatar Aug 24 '17 10:08 eli-b