Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Last active March 15, 2024 01:40
Show Gist options
  • Save Hermann-SW/ec9bfcb59a2ad0b64336519c48286ad6 to your computer and use it in GitHub Desktop.
Save Hermann-SW/ec9bfcb59a2ad0b64336519c48286ad6 to your computer and use it in GitHub Desktop.
Open graphviz .dot file in GraphvizFiddle in browser
#!/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)
@Hermann-SW
Copy link
Author

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