나는 redish-py를 geish와 함께 사용하고 있으며 Greenlet에서 상속 한 자체 클래스 인 EventBot을 사용합니다. 내가 스크립트를 실행하려고 때로는 때 연결이gevent + redis-py : SystemError : PyObject_Call에서 NULL없이 결과가 NULL입니다.
self._redis = Client(serializer=serialization.JSON(), **self.REDIS_CONFIG)
을 사용하여 레디 스에 초기화하는하고이 클래스의 __init__
방법에서
, 그것은 SystemError: NULL result without error in PyObject_Call
발생하지만 때로는 정상적으로 시작됩니다. 또한 redis 초기화를 _run()
메소드로 옮기려고 시도했지만 도움이되지 않았습니다. 여기
from gevent import monkey, Greenlet
monkey.patch_all()
from sleekxmpp import ClientXMPP
from redish import serialization
from redish.client import Client
class EventBot(ClientXMPP, Greenlet):
REDIS_CONFIG = {
'host': 'localhost',
'port': 6379,
'db': ""
}
def __init__(self, jid, password, redis_config=None):
ClientXMPP.__init__(self, jid, password)
Greenlet.__init__(self)
# Redis init
if redis_config is not None:
self.REDIS_CONFIG.update(redis_config)
self._redis = Client(serializer=serialization.JSON(), **self.REDIS_CONFIG)
QUESTIONS_KEY = __name__ + '_questions'
try:
self._questions = self._redis[QUESTIONS_KEY]
except KeyError:
self._questions = self._redis[QUESTIONS_KEY] = {}
## Class simplified for better readability ##
def _run(self):
self.connect()
self.process(block=False)
전체 역 추적한다 : 어떤 도움을 크게 감상 할 수
Traceback (most recent call last):
File "start.py", line 15, in <module>
bot = EventBot('[email protected]', 'XXXpasswordXXX')
File "/tmp/sandbox/gmarie/gmarie/marie/eventbot.py", line 41, in __init__
self._questions = self._redis[QUESTIONS_KEY]
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redish/client.py", line 196, in __getitem__
value = self.api.get(name)
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/client.py", line 551, in get
return self.execute_command('GET', name)
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/client.py", line 360, in execute_command
connection.send_command(*args)
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/connection.py", line 301, in send_command
self.send_packed_command(self.pack_command(*args))
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/connection.py", line 283, in send_packed_command
self.connect()
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/connection.py", line 228, in connect
sock = self._connect()
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/redis/connection.py", line 240, in _connect
sock.connect((self.host, self.port))
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/gevent/socket.py", line 376, in connect
wait_readwrite(sock.fileno(), event=self._rw_event)
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/gevent/socket.py", line 215, in wait_readwrite
switch_result = get_hub().switch()
File "/tmp/sandbox/gmarie/venv/lib/python2.7/site-packages/gevent/hub.py", line 164, in switch
return greenlet.switch(self)
SystemError: NULL result without error in PyObject_Call
Exception KeyError: KeyError(21246672,) in <module 'threading' from '/usr/lib64/python2.7/threading.py'> ignored
이것은 내가 사용하고있는 단순화 된 클래스입니다.
편집 : gevent
및 greenlet
시스템 패키지 (아치 리눅스에서 python2-gevent
및 python2-greenlet
)를 사용하지만, 추가 패치가 수행되지 않습니다 자신의 PKGBUILD에 따라 때
문제가 해결 될 것으로 보인다. (gevent, greenlet) 누군가가 pip를 사용하여 설치하는 것이 잘못된지 설명 할 수 있습니까?
감사합니다. -이 문제는 우분투를 실행하는 ARM 보드의 간단한 gevent 기반 클라이언트 응용 프로그램에서 발생했습니다. 귀하의 제안은 저를 위해 그것을 고쳤습니다. 단지 궁금한 점 : 이것이 gcc 관련 문제인지 어떻게 판단 했습니까? – scorpiodawg