Closed ETCHKILI closed 1 year ago
@techoner @Nekotoxin
@BustDot
@ETCHKILI What's your casbin_async_sqlalchemy_adapter
version? Update to 1.2.0 may solve this problem.
@ChenHaolinOlym After i switch to v1.2.0, it does work.The data was saved as expected, however i still encountered some error. I can't tell the reason, maybe it's because of the behavior of asyncio. I'm working on ubuntu 18.04, python 3.10, if it's needed.
Fatal error on SSL transport
protocol: <asyncio.sslproto.SSLProtocol object at 0x7fb71c797b50>
transport: <_SelectorSocketTransport closing fd=9>
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/selector_events.py", line 924, in write
n = self._sock.send(data)
OSError: [Errno 9] Bad file descriptor
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.10/asyncio/sslproto.py", line 690, in _process_write_backlog
self._transport.write(chunk)
File "/usr/lib/python3.10/asyncio/selector_events.py", line 930, in write
self._fatal_error(exc, 'Fatal write error on socket transport')
File "/usr/lib/python3.10/asyncio/selector_events.py", line 725, in _fatal_error
self._force_close(exc)
File "/usr/lib/python3.10/asyncio/selector_events.py", line 737, in _force_close
self._loop.call_soon(self._call_connection_lost, exc)
File "/usr/lib/python3.10/asyncio/base_events.py", line 753, in call_soon
self._check_closed()
File "/usr/lib/python3.10/asyncio/base_events.py", line 515, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
It seems that this is an asyncio problem, not related to casbin. But you may try
loop = asyncio.get_event_loop()
loop.run_until_complete(run_code())
instead of
asyncio.run(run_code())
@ChenHaolinOlym Thanks! This solves my problem.
after i ran this, i got something wrong with the save_policy() function
The traceback information indicates that this function in
adapter.py
didn't work:I'm not skilled with sqlalchemy, can anyone help?