[SOLVED] External Plugins Directory Location for Ubuntu

Hey all,
I have a few python external plugins that I use on my OSX machine. I recently started using Ubuntu on another computer and would like to copy those plugins to my linux machine.
But I’m having trouble finding the correct directory to keep my python files in order to access the plugins in PCBnew. I’m very new to Ubuntu so if anyone could offer advice or a resource I can use to understand the file system of KiCad on Ubuntu, that would be awesome.

I’m currently running KiCad 5.1.4 on Ubuntu 18.04.

Thanks

~/.kicad/scripting/plugins
or
~/.kicad_plugins

Thanks for the qu1ck response!
I copied my .py files into ~/kicad/scripting/plugins but did not see them in the External Plugins list in PCBnew.
Is there some step I’m missing?
This is the same folder with qfn_wizard.py and qrcode_footprint_wizard.py correct?

Reading comprehension. You are missing a dot in the path.

I think I’m missing more than reading comprehension :thinking:. Before responding, I tried:
~$ cd /.kicad
_bash: cd: /.kicad: No such file or directory_cd
~$ cd .kicad
bash: cd: .kicad: No such file or directory

If directory doesn’t exist you can create it. But there definitely should be .kicad in your home directory if you launched kicad at least once.

I do not see .kicad in my home folder:
don@don-ThinkPad-X240:/home$ dir
don

I have a kicad folder here:
don@don-ThinkPad-X240:/usr/share/kicad$ dir
demos internat library modules plugins scripting template

.kicad is hidden (the convention on *nix: files starting with dot are hidden from basic file list views). Use “ls -a” command to see it. Your home directory is probably “/home/don/”, not “/home/”.

Don’t ever mess up with anything under /usr/ unless you know what you are doing.

1 Like

Thanks for help - but I cant seem to locate it and ls-a wasn’t found as a command.

don@don-ThinkPad-X240:~$ cd .kicad
bash: cd: .kicad: No such file or directory
don@don-ThinkPad-X240:~$ ls-a
ls-a: command not found

Thanks for your patience!

Run this:
cd "$HOME"
and then this
mkdir -p .kicad/scripting/plugins

It will create necessary directories if they are not already there.

1 Like

ls -a (with space), not ls-a. “-a” is an option to the ls command. (Dir is similar to ls, you can use it, too.)

2 Likes

Created the folder:
don@don-ThinkPad-X240:/home$ cd $HOME
don@don-ThinkPad-X240:~$ mkdir -p .kicad/scripting/plugins

And copied the script into it:

picknplace_assistant/plugin – kicad 5.1$ cp pnpassist_action.py /home/don/.kicad/scripting/plugins
Double checked it was properly copied to the right directory.
Then when I go to the Tools pulldown in pcbnew and mouse over to External Plugins, my only option is to ‘Refresh’ - I’ve restarted Kicad between each attempt.

Ah! I see! Thank you
And thanks for the heads up. Still learning!

Open pcbnew scripting console and run this:

import pcbnew
pcbnew.GetWizardsBackTrace()

Paste output here. Most likely you are missing some dependencies.

1 Like
import pcbnew
pcbnew.GetWizardsBackTrace()
Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 64, in runsource
    code = self.compile(source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 168, in __call__
    return _maybe_compile(self.compiler, source, filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 99, in _maybe_compile
    raise err1
  File "/usr/lib/python3.6/codeop.py", line 87, in _maybe_compile
    code1 = compiler(source + "\n", filename, symbol)
  File "/usr/lib/python3.6/codeop.py", line 133, in __call__
    codeob = compile(source, filename, symbol, self.flags, 1)
  File "<input>", line 1
    import pcbnew
                ^
SyntaxError: multiple statements found while compiling a single statement

Copy them one line at a time into the command prompt, not both together. Press enter after each one. Interpreter in built in shell is a bit of a dummy.

In my kubuntu 18.04 installation is
~/.config/kicad
and the plugins in
~/.config/kicad/scripting

That path varies for distributions, but ~/.kicad is always the same. See https://github.com/KiCad/kicad-source-mirror/blob/master/scripting/kicadplugins.i#L170

Actually that path shouldn’t vary between the (*nix systems or) distributions. According to the FAQ entry Where are the configuration files (settings, library tables)? .config is always used (unless the environment variable has been set). I don’t remember the details but I was careful and checked from the source code.

On the other hand this doesn’t matter much - kicad searches for plugins in several directories and if it’s found in one of them it’s OK. User’s home dir/.kicad should work on all systems, I guess.

Hei, @qu1ck, I’m not arguing about what is right or not.

As @dongero is using ubuntu 18.04 I just limited myself to tell which directories are in my kubuntu 18.04 installation, just in case it can be useful for him. I do not have a~/.kicad folder. That’s all.

Also in Ubuntu 16.04 use
~/.kicad_plugins
or
~/.config/kicad/scripting