Calling external program directly from Eeschema


#1

Hi,
I am new to Kicad and Eeschema and was wondering if there was a way to call an external file, such as a python script, directly from Eeschema, similar to how a netlist or a BOM can be created by calling a script.
Thank you.


#2

Not possible. The only way would be to call it as a BOM script, it doesn’t have to create a BOM since KiCad doesn’t look at the output.


#3

Hi,
Thank you. However, when I try calling any BOM script, I get the following error:

"
Command error. Return code 1

Error messages:
File “C:\Python36\Lib/site.py”, line 178
file=sys.stderr)
^
SyntaxError: invalid syntax

Would you know why?


#4

What does your command line look like?

It looks like there is a mix up between python 2.7 and 3.6. If you have a python 2 script, run it with py -2, otherwise use py -3 for Python 3.


#5

My command line is : python “C:\KiCad\bin\scripting\plugins\bom_csv_grouped_by_value.py” “%I” “%O”

Should I be saying:
python-3 “C:\KiCad\bin\scripting\plugins\bom_csv_grouped_by_value.py” “%I” “%O” ?


#6

I use a test script called pyver.py, it prints hello and the python version. Python 3 installs the command “py”, which can call up Python 2 or 3.

So:
“python --version” calls python 2.7
“py -2 --version” calls python 2.7
“py -3 --version” calls python 3.6

You can try all those commands in a command prompt to confirm. It might be different depending on how you have your path variables set. I also have Python 2.7 and 3.6 installed which might make a difference.

An example:

My pyver.py script

import sys
print ("hello Python %s world!" % sys.version.split()[0])

#7

Oh Thank you! I think the problem might be that I am using Python3 not Python 2 and KiCad reads python2.
I’ll try it and let you know if it works.
Thanks again!