I’m trying to use the python interface of pcbnew to export/import Specctra DSN/SES files, but I’m running into some trouble.
I’ve installed the KiCad nightly PPA on Ubuntu 20.04 following the instructions here. However, when I call ExportSpecctraDSN(“output.dsn”) it returns false. Other commands seem to work fine such as printing out the modules in the file.
Does anyone have any suggestions for how to debug further into what might be going wrong? I’ve checked that exporting works from the pcbnew UI. Importing is broken similarly.
b = pcbnew.LoadBoard(sys.argv)
for m in b.GetModules():
There has been developer discussion about these kind of things in general, they want to separate logic from the UI. At the moment those two are too intertwined. But that takes much work and time. Unfortunately the developers haven’t been willing to write out any details which could help outsiders, so you just have to ask about this detail in the mailing list. IIRC producing output files has been one area which has been mentioned explicitly.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/gtaubman/kicad/build/release/pcbnew/pcbnew.py", line 903, in <module>
PCB_MODULE_ZONE_AREA_T = _pcbnew.PCB_MODULE_ZONE_AREA_T
AttributeError: module '_pcbnew' has no attribute 'PCB_MODULE_ZONE_AREA_T'
Does anyone have any suggestions for what i might be doing wrong when building, such that some symbols are not available but others are?
It’s not enough to import pcbnew.py module, you need to put the python dynamic library that pcbnew.py uses in LD_LIBRARY_PATH or whatever python uses to look for it’s libraries. I think it’s called either pcbnew.so or pcbnew.pyd on linux, should be somewhere in your pcbnew build directory.
You can muck around with environment variables or just run make installto have kicad install script put all the files somewhere system will find them, ususally /usr/local. You also may have to run ldconfig once.