AttributeError: 'ApiClient' object has no attribute 'pool'

Im using the example from The Python zrok SDK and works well until it tries to close the connection with

zrok.share.DeleteShare(root=root, shr=shr)

I get always the same error:

zrok.share.DeleteShare(root=root, shr=shr)

File "/Users/diego/PycharmProjects/zroktest/.venv/lib/python3.12/site-packages/zrok/", line 101, in DeleteShare
raise Exception("error getting zrok client", e)
Exception: ('error getting zrok client', RuntimeError("can't create new thread at interpreter shutdown"))
Exception ignored in: <function ApiClient.del at 0x1063af560>
Traceback (most recent call last):
File "/Users/diego/PycharmProjects/zroktest/.venv/lib/python3.12/site-packages/zrok_api/", line 78, in del
AttributeError: 'ApiClient' object has no attribute 'pool'

The problem is that after using the script several times, I get several connections that never close.

Any advice?

Hey there @diegobugnot, I finally found a way to create a problem like you described. I didn't get the AttributeError exception, but I do have leftover public shares that were created by the Python sample.

The Python sample only calls removeShare() if it exits gracefully, e.g., via SIGTERM (15). If I send SIGKILL (9) or SIGQUIT (3), the program doesn't have a chance to delete the share before it stops running.

Maybe PyCharm is stopping the debugger process with a more forceful signal. I noticed that VS Code debugger does forcefully signal the process, so the same problem occurs there.

If you run the program in a terminal and use ctrl+c to send SIGTERM, does the same thing happen?