Handle Bunch/Munch import failure
This commit is contained in:
parent
0447ffcb5c
commit
a9543243b4
|
@ -1,3 +1,4 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
# BUNCH
|
||||
|
@ -6,11 +7,15 @@ try:
|
|||
Bunch = munch.Munch
|
||||
bunchify = munch.munchify
|
||||
unbunchify = munch.unmunchify
|
||||
except Exception:
|
||||
import bunch
|
||||
Bunch = munch.Bunch
|
||||
bunchify = munch.bunchify
|
||||
unbunchify = munch.unbunchify
|
||||
except ModuleNotFoundError:
|
||||
try:
|
||||
import bunch
|
||||
Bunch = munch.Bunch
|
||||
bunchify = munch.bunchify
|
||||
unbunchify = munch.unbunchify
|
||||
except ModuleNotFoundError:
|
||||
print("Error: Could not find munch/bunch module. Install munch on Python 3, bunch on Python 2.",file=sys.stderr)
|
||||
sys.exit(1)
|
||||
|
||||
# GLOBALS
|
||||
g = Bunch()
|
||||
|
|
Loading…
Reference in New Issue