Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit 88e493d

Browse files
move termcolor loading to after config file load
1 parent 2fd5ea4 commit 88e493d

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

octoprint-cli.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,28 +49,6 @@ def init_config():
4949
print(colored("X-API-Key is incorrect", 'red', attrs=['bold']))
5050
sys.exit(1)
5151

52-
color = True #termcolor configuration
53-
if os.name=='nt':
54-
def colored(*args, attrs=None):
55-
return args[0]
56-
color = False
57-
try:
58-
if config['preferences']['FormattedText'] == "false":
59-
def colored(*args, attrs=None):
60-
return args[0]
61-
color = False
62-
except KeyError:
63-
pass
64-
if color == True:
65-
try:
66-
from termcolor import colored
67-
except ImportError:
68-
print("termcolor module not installed")
69-
sys.exit(1)
70-
else:
71-
def colored(*args, attrs=None):
72-
return args[0]
73-
7452
def version(args):
7553
data=caller.getVersionInfo()
7654
print("OctoPrint v" + data['server'] + " - API v" + data['api'])
@@ -685,6 +663,28 @@ def files_upload(args):
685663
sys.exit(1)
686664
init_config()
687665

666+
color = True #termcolor configuration
667+
if os.name=='nt':
668+
def colored(*args, attrs=None):
669+
return args[0]
670+
color = False
671+
try:
672+
if config['preferences']['FormattedText'] == "false":
673+
def colored(*args, attrs=None):
674+
return args[0]
675+
color = False
676+
except KeyError:
677+
pass
678+
if color == True:
679+
try:
680+
from termcolor import colored
681+
except ImportError:
682+
print("termcolor module not installed")
683+
sys.exit(1)
684+
else:
685+
def colored(*args, attrs=None):
686+
return args[0]
687+
688688
try:
689689
options.func(options)
690690
except AttributeError:

0 commit comments

Comments
 (0)