indilib / pyindi-client

GNU General Public License v3.0
21 stars 8 forks source link

Address issues with the example in README.md #15

Closed nybble41 closed 2 years ago

nybble41 commented 2 years ago

The first and most critical issue is that there is no SWIG wrapper defined for INDI::Properties, so d.getProperties() returns a non-iterable generic proxy for PySwigObject *. This was addressed by adding %include <indiproperties.h> and definitions for __getitem__ and __len__ to the SWIG template. I believe this also addresses a warning about a missing destructor call. I had to tell SWIG to ignore the at, front, and back member functions to prevent C++ compilation errors related to creating pointers to references (obscured by a typedef used in the method declaration), and also the empty member function which for some reason caused a runtime link error due to a missing symbol when the PyIndi library was loaded. (Perhaps the optimization settings differ between the system INDI library and the SWIG wrapper, so the INDI library expected empty to be inlined but the wrapper failed to do so?)

The second issue, easily corrected, is that there is no .decode() method on the objects returned by .name and .device. I tested this in both Python 3.10 and Python 2.7 and in both environments it sufficed to simply remove the .decode() calls, as the objects are already of type str.

Finally, in testing the SWIG wrapper changes I found an error related to the use of super() without arguments in the CustomInstall class when running the setup.py install command with Python 2.7. This was addressed by explicity invoking the .run() method on the base class, which works in both Python 2.7 and Python 3.10.

abecadel commented 2 years ago

LGTM