Tools: use Python 3, improve import checks

In more detail:
- Change shebang to Python 3.
- Suggest installation using pip3 as user.
This commit is contained in:
Julian Oes
2020-01-16 16:25:26 +01:00
parent e98fa891fe
commit b04f68553e
7 changed files with 63 additions and 36 deletions
+7 -4
View File
@@ -8,6 +8,7 @@ import codecs
import re
import colorsys
import json
import sys
parser = argparse.ArgumentParser(
@@ -609,11 +610,13 @@ if args.output == 'json':
elif args.output == 'graphviz':
try:
from graphviz import Digraph
except:
print("Failed to import graphviz.")
print("You may need to install it with 'pip install graphviz'")
except ImportError as e:
print("Failed to import graphviz: " + e)
print("")
raise
print("You may need to install it with:")
print(" pip3 install --user graphviz")
print("")
sys.exit(1)
output_graphviz = OutputGraphviz(graph)
engine='fdp' # use neato or fdp
output_graphviz.write(args.file+'.fv', engine=engine)