summaryrefslogtreecommitdiff
path: root/eeschema/plugins/python_scripts/round_robin.py
diff options
context:
space:
mode:
authorsaurabhb172020-02-26 15:57:49 +0530
committersaurabhb172020-02-26 15:57:49 +0530
commitaa35045840b78d3f48212db45da59a2e5c69b223 (patch)
tree6acee185a4dc19113fcbf0f9a3d6941085dedaf7 /eeschema/plugins/python_scripts/round_robin.py
parent0db48f6533517ecebfd9f0693f89deca28408b76 (diff)
downloadKiCad-eSim-aa35045840b78d3f48212db45da59a2e5c69b223.tar.gz
KiCad-eSim-aa35045840b78d3f48212db45da59a2e5c69b223.tar.bz2
KiCad-eSim-aa35045840b78d3f48212db45da59a2e5c69b223.zip
Added main execs
Diffstat (limited to 'eeschema/plugins/python_scripts/round_robin.py')
-rw-r--r--eeschema/plugins/python_scripts/round_robin.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/eeschema/plugins/python_scripts/round_robin.py b/eeschema/plugins/python_scripts/round_robin.py
new file mode 100644
index 0000000..0f15e6f
--- /dev/null
+++ b/eeschema/plugins/python_scripts/round_robin.py
@@ -0,0 +1,28 @@
+#
+# Example python script to generate an equivalent XML document from XML input
+#
+# Example: Round robin, XML to XML conversion
+#
+
+from __future__ import print_function
+
+# Import the KiCad python helper module and the csv formatter
+import kicad_netlist_reader
+import sys
+import pdb
+
+
+# Generate an instance of a generic netlist, and load the netlist tree from
+# the command line option. If the file doesn't exist, execution will stop
+net = kicad_netlist_reader.netlist(sys.argv[1])
+
+# Open a file to write to, if the file cannot be opened output to stdout
+# instead
+try:
+ f = open(sys.argv[2], 'w')
+except IOError:
+ e = "Can't open output file for writing: " + sys.argv[2]
+ print( __file__, ":", e, sys.stderr)
+ f = sys.stdout
+
+print(net.formatXML(), file=f)