← Back to team overview

kicad-developers team mailing list archive

Re: Default location for Python plug-in scripts on OS X?

 

> On Mar 3, 2015, at 1:58 PM, Bernhard Stegmaier <stegmaier@xxxxxxxxxxxxx> wrote:
> 
> These are the default paths which I have added or adapted from previous code some while back:
>     // User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
> pypath = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" ); 
> // Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)   
> pypath += wxT( ":" ) + GetOSXKicadMachineDataDir() + wxT( "/scripting/plugins" );
> // Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
> pypath += wxT( ":" ) + GetOSXKicadDataDir() + wxT( "/scripting/plugins" );
> // Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python/site-packages)
> pypath += wxT( ":" ) + Pgm().GetExecutablePath() +
> wxT( "Contents/Frameworks/python/site-packages" );
> // Original content of $PYTHONPATH
> if( wxGetenv("PYTHONPATH") != NULL )   
> {        
> pypath = wxString( wxGetenv("PYTHONPATH") ) + wxT( ":" ) + pypath;    
> }

Ah, OK, in my ~/Library/Application Support/kicad directory I have a subdirectory called plugins, which has the BOM XSL stuff. I thought that would a reasonable place for plugins to go, so I put the Python scripts there. That didn't work.

But Berhnard's suggestions were good. I put them in ~/Library/Application Support/kicad/scripting/plugins and it worked. I even saw pcbnew compiling the .py scripts into .pyc files as it opened. I opened the footprint editor and did the "new footprint from wizard" and a list of scripts popped up.

I copied the plugin scripts from /Applications/kicad/Kicad/Contents/SharedSupport/scripting/plugins, which is where they ended up after building and doing the make install and then copying the bundle to /Applications/kicad/. According to the code above, pcbnew should have found the scripts, but it didn't (or couldn't compile them for some reason?).

And from a user point of view, this is confusing, having a plugins directory and a scripting/plugins directory. 



> I must confess though, that I never did really test it because
> * the latest build with Python enabled had issues with hotkeys in the editor (all hotkeys got eaten and didn’t appear in the Python console)

I saw that -- I tried to type in the Python console and it was completely hosed -- 'h' brought up a schematic, for some reason.

Gotta file a bug report, if one hasn't already been filed.


> * I didn’t have any idea on how to use scripting…

My immediate interest was the footprint wizard. I also have this idea of running a script which would renumber the reference designators in a geographical fashion (so assembly/test techs don't hate the layout) and backannotate that to the schematic. But I might wait until scripting comes to eeschema.

> 
> 
> Regards,
> Bernhard
> 
> 
>> On 03 Mar 2015, at 20:52, Nick Østergaard <oe.nick@xxxxxxxxx> wrote:
>> 
>> On linux it is in $HOME/.kicad_plugins/
>> 
>> 2015-03-03 20:26 GMT+01:00 Andy Peters <devel@xxxxxxxxx>:
>>> Subject says it all ...
>>> 
>>> I enabled Python scripting in my OS X builds and wanted to try the footprint plug-in, but I don't know where pcbnew looks for the scripts, and it thinks none are available.
>>> 
>>> I'm on BZR 5469.
>>> 
>>> Say thankya.
>>> 
>>> -a
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~kicad-developers
>>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~kicad-developers
>>> More help   : https://help.launchpad.net/ListHelp
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~kicad-developers
>> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
>> Unsubscribe : https://launchpad.net/~kicad-developers
>> More help   : https://help.launchpad.net/ListHelp
> 

Andy Peters
5511 E Rosewood St
Tucson, AZ 85711
520-907-2262
devel@xxxxxxxxx





References