py-substrate-interface
py-substrate-interface copied to clipboard
Decoder class for "Compact<u32>" not found
Hi,
I sometimes encounter the following error when executing the following code:
The error that I seem to get is related to: Decoder class for "Compact<u32>" not found
Do you know how I could work around this ? I tried to add a try except clause in there, but it still doesnt seem to work.
Thanks !
Im having the same problem. It seems to happen occasionally when im multithreading.
The library is currently not thread-safe, so it is highly recommended to have a dedicated instance of SubstrateInterface for each thread.
I am currently working on version 2 of the library, which will include asyncio support. However, this is likely to take a few more months to complete.
This can happen even when using an instance per thread, in which case it's really a duplicate of #336. What I can recommend as a workaround, rather than trying to catch the error, is just to replace any threads that exit due to the error with new threads. There's a skeleton of my workflow on the linked issue.
I am currently working on version 2 of the library, which will include asyncio support. However, this is likely to take a few more months to complete.
Glad to read that your plan is to support thread-safe capability !
I am using the library in a Qt5 project where the main loop event is handle by Qt5 and I use Qt5 threads. I hope the support for asyncio will not be "only usable with a asyncio project and main loop". If the library is going to be thread safe, ideally it should be for any concurrency solution used by the main project (threads, asyncio, etc).
For now, I am using a home made queue system to handle thread calls to the same Substrate() connection, as a workaround.