简体   繁体   English

PyV8:事件队列已满

[英]PyV8: event queue full

I'm using PyV8 and I get this error: 我正在使用PyV8,但出现此错误:

#...
  File "code\engine\window.py", line 345, in run_script
    res = self.js_context.eval(js)
error: Event queue full

I am indeed running multiple things at once. 我确实一次运行了很多事情。 How can I get around this limitation? 我如何解决这个限制? I haven't managed to find any mention of this anywhere... the trouble with only running on .eval() at a time is that I have javascript code calling python code which calls back into the javascript code... 我没有设法在任何地方找到任何提及...一次只在.eval()上运行的麻烦是我有javascript代码调用了python代码,而该python代码又回调了javascript代码...

What I ended up doing was protecting the entry points into javascript processing (from fresh python) with a threading.Lock . 我最终要做的是使用threading.Lock保护进入javascript处理的入口点(来自新鲜的python)。 The require function, already being "in JS context", bypassed this lock, whereas callbacks that went back out into Python and back into JavaScript went through the lock. require功能已经“处于JS上下文中”,绕过了此锁,而回溯到Python和JavaScript中的回调均通过了该锁。 This seems to have done the trick for now. 到目前为止,这似乎已经解决了问题。 I wonder if that wasn't the point of PyV8.JSLocker , but it didn't seem to work well using only that class for the lock... 我想知道这是否不是PyV8.JSLocker ,但是仅使用该类作为锁似乎并不能很好地工作...

Oh boy. 好家伙。 It's just PyV8's poor error reporting at fault. 这只是PyV8错误的错误报告。 What happened is my app uses pygame, and it was posting too many pygame events (thus overflowing its queue) before dealing with them. 发生了什么事是我的应用程序使用pygame的,和它处理的是他们之前发布太多pygame的事件(从而溢出队列)。 I really wish PyV8 would show the line numbers where the error happened, in the python code called from the javascript code... 我真的希望PyV8在从javascript代码调用的python代码中显示发生错误的行号...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM