keijack / python-eureka-client

A eureka client written in python. Support registering your python component to Eureka Server, as well as calling remote services by pulling the the Eureka registry.
MIT License
183 stars 43 forks source link

AttributeError: 'Timer' object has no attribute 'isAlive' #53

Closed uwohlfeil closed 3 years ago

uwohlfeil commented 3 years ago

With Python 3.9.5 I geht the following error:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/uw/development/python_enaio_metrics/env/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 1712, in _cleanup_before_exist
    cli.stop()
  File "/home/uw/development/python_enaio_metrics/env/lib/python3.9/site-packages/py_eureka_client/eureka_client.py", line 1534, in stop
    if self.__heartbeat_timer.isAlive():
AttributeError: 'Timer' object has no attribute 'isAlive'

The problematic line (eureka_client.py:1534) is:

    def stop(self) -> None:
        if self.__heartbeat_timer.isAlive():

It seems to be related to Python Issue 37804.

If I change the line to:

    def stop(self) -> None:
        if self.__heartbeat_timer.is_alive():

Everything seems to work. The method is_alive seems to exists at lease since python 2.7 and python 3.5.

Can you change this to is_alive ?

keijack commented 3 years ago

Of course, please check out version 0.9.10

keijack commented 3 years ago

I close this, if you have any problem, please re-open it, thanks for submitting.