Skip to content

catch-22: Controlling force_terminal value based on command line arguments #484

Answered by willmcgugan
ssbarnea asked this question in Q&A
Discussion options

You must be logged in to vote

You can replace a reference to the Console instance once you have read the conf, but that wouldn't help if you have already imported a reference in an other module.

You can't really reconfigure a Console instance via the API, but something like this should work:

from my_project import console

def reconfigure_console(*args, **kwargs):
    global console
    new_console = Console(*args, **kwargs)
    console.__dict__ = new_console.__dict__

It's a bit of a hack, but I can't see it breaking anything.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@ssbarnea
Comment options

Answer selected by ssbarnea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants