Scripting path for Linux/Ubuntu [BZR5852]

First off, thanks to everyone involved in helping! Great to see such an active (although widely spread) community. I’ve decided that this would be the best place to start asking some questions that come to mind regarding Kicad that I haven’t been able to figure out on my own.

What is the path of the folder where the Python scripts should be placed for pcbnew? I’ve scoured the net, manuals, the developer mailing list, dug through the install script, tried searching for any kicad related folders but I just can’t see what I’m missing.

I’ve tried putting a script (hide values, show references) in usr/local/share/kicad/demos/python_scripting_examples, usr/local/share/doc/kicad/scripts, or in usr/local/lib/kicad/plugins, followed by trying to run the script in the console in pcbnew by invoking ‘import filename’, but no result or message. The second folder I mentioned shows some test-plugins, but trying to load them just returns an error so this is not the correct folder either. I also saw mention of a ~/.kicad_plugins folder, but I can’t seem to find it on my system (tried ls -la but it’s not showing up).

Can anyone shed some light on this? Ever since I switched to Ubuntu 3 months ago and regularly updated Kicad it has been a great pleasure using this program, but manually changing designators etc. is very tedious.

Kind regards,
Jules

I’ve put python footprint wizards into ~/.kicad_plugins (which I’ve created in ~/) and they work for me. I don’t know if it helps with other scripts.

Thanks! That did the trick. Turns out creating the folder and putting the scripts there (I had to create the folder myself aswell, I wonder why this is not done via the install script) seems to trick pcbnew into finding them.

Technically my problem is solved, but the next issue - something that I’ve noticed before when trying to enter scripts line-by-line in the console - is that I get this error message:

import newtestscript
Traceback (most recent call last):
File “< input>”, line 1, in
File “/home/jules/.kicad_plugins/newtestscript.py”, line 6, in
filename=sys.argv[1]
AttributeError: ‘module’ object has no attribute ‘argv’

It’s related to getting the current filename for the board. Guess I have some more digging to do!

Hi,
do you know which is the right path in windows?

thanks
Maurice

Hi … I found that in windows the right path is:

C:\KiCad\bin\scripting\plugins