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

Commit

Permalink
move termcolor loading to after config file load
Browse files Browse the repository at this point in the history
  • Loading branch information
UserBlackBox committed Oct 26, 2020
1 parent 2fd5ea4 commit 88e493d
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions octoprint-cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,6 @@ def init_config():
print(colored("X-API-Key is incorrect", 'red', attrs=['bold']))
sys.exit(1)

color = True #termcolor configuration
if os.name=='nt':
def colored(*args, attrs=None):
return args[0]
color = False
try:
if config['preferences']['FormattedText'] == "false":
def colored(*args, attrs=None):
return args[0]
color = False
except KeyError:
pass
if color == True:
try:
from termcolor import colored
except ImportError:
print("termcolor module not installed")
sys.exit(1)
else:
def colored(*args, attrs=None):
return args[0]

def version(args):
data=caller.getVersionInfo()
print("OctoPrint v" + data['server'] + " - API v" + data['api'])
Expand Down Expand Up @@ -685,6 +663,28 @@ def files_upload(args):
sys.exit(1)
init_config()

color = True #termcolor configuration
if os.name=='nt':
def colored(*args, attrs=None):
return args[0]
color = False
try:
if config['preferences']['FormattedText'] == "false":
def colored(*args, attrs=None):
return args[0]
color = False
except KeyError:
pass
if color == True:
try:
from termcolor import colored
except ImportError:
print("termcolor module not installed")
sys.exit(1)
else:
def colored(*args, attrs=None):
return args[0]

try:
options.func(options)
except AttributeError:
Expand Down

0 comments on commit 88e493d

Please sign in to comment.