The LoadBoard() function is invalid?

Executing scripts in the console keeps reporting errors, as does plug-ins!


QQ20210929115547

Application: KiCad PCB 编辑器 (64-bit)

Version: (5.99.0-12597-g9f841da98e), release build

Libraries:
wxWidgets 3.1.5
libcurl/7.78.0-DEV Schannel zlib/1.2.11

Platform: Windows 10 (build 19043), 64-bit edition, 64 bit, Little endian, wxMSW

Build Info:
Date: Sep 28 2021 00:32:52
wxWidgets: 3.1.5 (wchar_t,wx containers)
Boost: 1.76.0
OCC: 7.5.0
Curl: 7.78.0-DEV
ngspice: 35
Compiler: Visual C++ 1929 without C++ ABI

Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON

Scripts and plugins written for 5.1 will not necessarily work for 5.99, they need to be adapted.
In your case LoadBoard() is fine, it’s GetModules() that is throwing because it was renamed to GetFootprints()

1 Like

that error is associated with pcbnew and LoadBoard. Its returned None (ie a silent error occured) rather than an object.

The script expects a pcbnew board object and thus the next step is a method call will fail on a None type.
This is exactly the same error from the 1st post, just occuring at a different point.

Confirm the board has loaded

This isn’t a Kicad bug, but a 3rd party penalization bug. why open an issue on Kicad? especially since the python API is in flux? Expect this to be closed

I reported both! I also understand that the loadboard returns the none, but I’m not sure there is a bug in the loadboard function. Or I use errors caused, I hope someone to test it!

Did I use the wrong method? If so, I want you to explain the error, if not, then this is an API BUG, why can’t I feed back to the repository?

as I mentioned… the python API is in flux, every single use of this interface is at-risk so it isn’t a bug because it hasn’t stabilized.

1 Like

At the moment it is not possible to use the LoadBoard API inside the scripting console or an action plugin. You can use GetBoard to get the board that is loaded in the PCB editor, but you cannot load a different board (that is not loaded in the PCB editor).

Some time ago LoadBoard is normal, the use of its plug-in can also run normally, is the recent error, hope to stabilize API as soon as possible, I have been using kicad5.99, it is very useful, thank you very much for the efforts of developers! Looking forward to the release of version 6.0.