Last active
March 15, 2024 01:40
-
-
Save Hermann-SW/ec9bfcb59a2ad0b64336519c48286ad6 to your computer and use it in GitHub Desktop.
Open graphviz .dot file in GraphvizFiddle in browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" view graphviz file """ | |
# pylint: disable=C0103 | |
import sys | |
import webbrowser | |
import urllib.parse | |
import time | |
if len(sys.argv)<3: | |
print("Format: "+sys.argv[0]+" browser dotfile") | |
else: | |
B=webbrowser.get(sys.argv[1]) | |
with open(sys.argv[2], encoding="utf-8") as f: | |
s=urllib.parse.quote("".join(line for line in f)) | |
T=str(int(time.time())) | |
B.open("https://stamm-wilbrandt.de/GraphvizFiddle/2.1.2/?"+T+"#"+s) |
Revision 3 does use webbrowser module instead of os.system():
pi@raspberrypi5:~ $ pylint /usr/local/bin/GraphvizFiddle.py
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
pi@raspberrypi5:~ $
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
New gist "straight_line_graphviz.cpp" generates the complete graphviz graph as output:
https://gist.github.com/Hermann-SW/99d151a273d290ee0d843c79b2da26a8?permalink_comment_id=4985753#gistcomment-4985753
So now GraphvizFiddle.py is of real help and opens result directly in browser: