I’m just trying to get the simplest python script (the enumerate footprint example in section 15.4 of the Pcbnew manual) to work. I’ve tried that example script and a few others, and they all fail the same way; that is with some error message that complains about getattr. Does anybody know what I’m doing wrong? See the log following:
PyCrust 0.9.8 - KiCAD Python Shell
Python 2.7.10 (default, Jul 8 2015, 15:10:39)
[GCC 5.1.0] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>import sys
>>>sys.path
['C:\\Program Files\\KiCad\\lib\\python27.zip', 'C:\\Program Files\\KiCad\\lib\\python2.7', 'C:\\Program Files\\KiCad\\lib\\python2.7\\plat-win32', 'C:\\Program Files\\KiCad\\lib\\python2.7\\lib-tk', 'C:\\Program Files\\KiCad\\lib\\python2.7\\lib-old', 'C:\\Program Files\\KiCad\\lib\\python2.7\\lib-dynload', 'C:\\building\\msys32\\mingw64', 'C:\\Program Files\\KiCad\\lib\\python2.7\\site-packages', 'C:\\Program Files\\KiCad\\lib\\python2.7\\site-packages\\wx-3.0-msw', '.', 'C:/Program Files/KiCad/bin/../share/kicad/scripting/plugins']
>>>import pads
3M_3E106-1230KV ->Traceback (most recent call last):
File "<input>", line 1, in <module>
File "./pads.py", line 10, in <module>
print name,"->",m.GetLibRef(), m.GetReference()
File "C:\Program Files\KiCad\lib\python2.7\site-packages/pcbnew.py", line 5769, in <lambda>
__getattr__ = lambda self, name: _swig_getattr(self, MODULE, name)
File "C:\Program Files\KiCad\lib\python2.7\site-packages/pcbnew.py", line 74, in _swig_getattr
return _swig_getattr_nondynamic(self, class_type, name, 0)
File "C:\Program Files\KiCad\lib\python2.7\site-packages/pcbnew.py", line 69, in _swig_getattr_nondynamic
return object.__getattr__(self, name)
AttributeError: type object 'object' has no attribute '__getattr__'
>>>
(I’m running Kicad 4.0.1 on Windows 8.1. From the log, you can see that the script at least starts – “3M_3E106-1230KV” is an actual component in my footprint library, and it finds that.)