Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python3 installation, RecursionError #5

Closed
TallFurryMan opened this issue Jan 3, 2021 · 8 comments
Closed

Python3 installation, RecursionError #5

TallFurryMan opened this issue Jan 3, 2021 · 8 comments

Comments

@TallFurryMan
Copy link

I am trying to use a pip3 build of pyindi-client to retrieve the current temperature of a Moonlite focuser:

$ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyIndi
>>> class IC(PyIndi.BaseClient):
...     def __init__(self):
...             super(IC, self).__init__()
... 
>>> ic = IC()
>>> ic.setServer('192.168.1.191', 7624)
>>> ic.connectServer()
RecursionError: maximum recursion depth exceeded
$

Is there something obvious I am missing? This is on a 32-bit machine, but I doubt this has an impact.

@rkaczorek
Copy link
Collaborator

Does it happen with example testindiclient?

@geehalel
Copy link
Owner

geehalel commented Jan 5, 2021

Maybe in the serverConnected callback of the IC client class?
By the way I have built the latest indi core and tried to install pyindi-client but that now fails

 /usr/include/libindi/indiproperty.h:39: Error: Syntax error in input(3).
  error: command 'swig' failed with exit status 1

The DEFINE_PRIVATE macro seems to break swig

#define DECLARE_PRIVATE(Class) \
    inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(getPtrHelper(d_ptr)); } \
    inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(getPtrHelper(d_ptr)); } \
    friend class Class##Private;

I will try to investigate further that issue.

@geehalel
Copy link
Owner

geehalel commented Jan 5, 2021

I solved the issue above and updated pyindi-client on Pypi.
The testindiclient runs as expected, I don't see recursion error.

@TallFurryMan
Copy link
Author

TallFurryMan commented Jan 5, 2021

Thanks for updating this. I tested with the same parameters, and the result is (slightly) different:

$ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyIndi
>>> class IC(PyIndi.BaseClient):
...     def __init__(self):
...             super().__init__()
...
>>> ic = IC()
>>> ic.setServer('192.168.1.191', 7624)
>>> ic.connectServer()
RecursionError: maximum recursion depth exceeded
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 71, in apport_excepthook
    import re, traceback
Traceback (most recent call last):
  File "/home/tallfurryman/.local/lib/python3.6/site-packages/PyIndi.py", line 437, in newDevice
  File "/usr/lib/python3.6/traceback.py", line 5, in <module>
    return _PyIndi.BaseMediator_newDevice(self, dp)
TypeError: in method 'BaseMediator_newDevice', argument 2 of type 'INDI::BaseDevice *'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 71, in apport_excepthook
    import re, traceback
  File "/usr/lib/python3.6/traceback.py", line 5, in <module>
    import linecache
  File "/usr/lib/python3.6/linecache.py", line 11, in <module>
    import linecache
  File "/usr/lib/python3.6/linecache.py", line 11, in <module>
    import tokenize
  File "/usr/lib/python3.6/tokenize.py", line 99, in <module>
    import tokenize
  File "/usr/lib/python3.6/tokenize.py", line 99, in <module>
    class TokenInfo(collections.namedtuple('TokenInfo', 'type string start end line')):
  File "/usr/lib/python3.6/collections/__init__.py", line 429, in namedtuple
    class TokenInfo(collections.namedtuple('TokenInfo', 'type string start end line')):
  File "/usr/lib/python3.6/collections/__init__.py", line 429, in namedtuple
    exec(class_definition, namespace)
RecursionError: maximum recursion depth exceeded during compilation

Original exception was:
Traceback (most recent call last):
    exec(class_definition, namespace)
RecursionError: maximum recursion depth exceeded during compilation

Original exception was:
RecursionError: maximum recursion depth exceeded
terminate called without an active exception
Aborted (core dumped)

Let me try to dig a bit with another python and another indiserver.

@TallFurryMan
Copy link
Author

TallFurryMan commented Jan 5, 2021

By the way, I can't build for python2.7:

$ pip install pyindi-client
Collecting pyindi-client
  Using cached https://files.pythonhosted.org/packages/f7/fa/ca8d3794bbebb66a204707e8d179a7432e0668c9362119823911d25037e2/pyindi-client-0.2.6.tar.gz
Building wheels for collected packages: pyindi-client
  Running setup.py bdist_wheel for pyindi-client ... error
  Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-JDGITg/pyindi-client/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpxgRPzdpip-wheel- --python-tag cp27:
  running bdist_wheel
  running build
  running build_ext
  building '_PyIndi' extension
  swigging indiclientpython.i to indiclientpython_wrap.cpp
  swig -python -v -Wall -c++ -threads -I/usr/include -I/usr/include/libindi -I/usr/local/include/libindi -o indiclientpython_wrap.cpp indiclientpython.i
  Language subdirectory: python
  Search paths:
     ./
     /usr/include/
     /usr/include/libindi/
     /usr/local/include/libindi/
     ./swig_lib/python/
     /usr/share/swig3.0/python/
     ./swig_lib/
     /usr/share/swig3.0/
  Preprocessing...
  Starting language-specific parse...
  /usr/local/include/libindi/baseclient.h:39: Warning 322: Redundant redeclaration of 'MAXRBUF',
  /usr/local/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
  /usr/local/include/libindi/baseclient.h:270: Warning 325: Nested struct not currently supported (BLOBMode ignored)
  /usr/local/include/libindi/basedevice.h:29: Warning 322: Redundant redeclaration of 'MAXRBUF',
  /usr/local/include/libindi/indibase.h:8: Warning 322: previous declaration of 'MAXRBUF'.
  /usr/local/include/libindi/baseclient.h:61: Warning 403: Class 'INDI::BaseClient' might be abstract, no constructors generated,
  /usr/local/include/libindi/indibase.h:86: Warning 403: Method INDI::BaseMediator::newDevice(INDI::BaseDevice *) might not be implemented.
  Processing types...
  C++ analysis...
  Processing nested classes...
  Generating wrappers...
  creating build
  creating build/temp.linux-i686-2.7
  i686-linux-gnu-gcc -pthread -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rh9FfC/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include -I/usr/include/libindi -I/usr/local/include/libindi -I/usr/include/python2.7 -c indiclientpython_wrap.cpp -o build/temp.linux-i686-2.7/indiclientpython_wrap.o -std=c++11
  creating build/lib.linux-i686-2.7
  i686-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rh9FfC/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-rh9FfC/python2.7-2.7.17=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC build/temp.linux-i686-2.7/indiclientpython_wrap.o /usr/local/lib/libindiclient.a -lz -lcfitsio -lnova -o build/lib.linux-i686-2.7/_PyIndi.so
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-build-JDGITg/pyindi-client/setup.py", line 110, in <module>
      "Topic :: Scientific/Engineering :: Astronomy"
    File "/usr/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
      dist.run_commands()
    File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/usr/lib/python2.7/dist-packages/wheel/bdist_wheel.py", line 204, in run
      self.run_command('build')
    File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
      cmd_obj.run()
    File "/tmp/pip-build-JDGITg/pyindi-client/setup.py", line 57, in run
      super().run()
  TypeError: super() takes at least 1 argument (0 given)

  ----------------------------------------
  Failed building wheel for pyindi-client

But let's not get carried away.

@TallFurryMan
Copy link
Author

Sorry, I realise I forgot to add the INDI version I use:

$ grep -RInC3 version /usr/local/include/libindi/indiversion.h
1:/* Set INDI Library version */
2-#define INDI_VERSION 1.8.7
3-
4-/* Define INDI Data Dir */

@TallFurryMan
Copy link
Author

I confirm the testindiclient works properly, the issue is therefore in the simplistic definition of my example. Thanks! 👍

@geehalel
Copy link
Owner

geehalel commented Jan 5, 2021

You have to define every pure virtual functions of the indi client in Python, this is mandatory. So just copy the testindiclient class and just suppress the logs I put there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants