txaio
txaio copied to clipboard
txaio.time_ns requires networking framework selection
The WAMP IDL code generator (xbrnetwork
CLI included with Autobahn) currently generates code that imports txaio and select Twisted. When writing asyncio programs, this is inconvenient. The problem is time_ns
:
(cpy392_1) oberstet@intel-nuci7:~$ python
Python 3.9.2 (default, Mar 8 2021, 02:05:12)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from txaio import time_ns
>>> time_ns()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oberstet/scm/crossbario/txaio/txaio/_unframework.py", line 41, in _throw_usage_error
raise RuntimeError(
RuntimeError: To use txaio, you must first select a framework with .use_twisted() or .use_asyncio()
>>>
We either need a way to use txaio.time_ns
without selecting a networking framework, or we need to move the helper eg to zLMDB.
Kind of the whole premise of txaio
is "select things via imports" .. now, those are usually like the autobahn.wamp.{twisted,asyncio}
method (the .use_*()
calls are in there) but ... might be expedient to just move / duplicate it..?
...but also, it seems it's only there to support Python versions less than 3.7 -- above that it's time.time_ns()