CherryPy Autoloader死于bcrypt

时间:2017-11-17 15:09:49

标签: cherrypy

我在CherryPy上有纯项目,并希望AuthTool使用bcrypt模块进行密码处理。

但是当我把"导入bcrypt"换成AuthTool.py,CherryPy告诉我:

[17/Nov/2017:17:55:57] ENGINE Error in background task thread function <bound method Autoreloader.run of <cherrypy.process.plugins.Autoreloader object at 0x0000026948C82E80>>.
AttributeError: cffi library '_bcrypt' has no function, constant or global variable named '__loader__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 519, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 651, in run
    for filename in self.sysfiles() | self.files:
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 635, in sysfiles
    hasattr(m, '__loader__') and
SystemError: <built-in function hasattr> returned a result with an error set

Exception in thread Autoreloader:
AttributeError: cffi library '_bcrypt' has no function, constant or global variable named '__loader__'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 519, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 651, in run
    for filename in self.sysfiles() | self.files:
  File "C:\Users\Serge\AppData\Local\Programs\Python\Python36\lib\site-packages\cherrypy\process\plugins.py", line 635, in sysfiles
    hasattr(m, '__loader__') and
SystemError: <built-in function hasattr> returned a result with an error set

在那之后,everithing工作正常,但Autoloader。我有bcrypt(3.1.4)和CherryPy(11.1.0)。

我可以做些什么来解决这个问题这个自动重载程序吗?的Merci。

1 个答案:

答案 0 :(得分:2)

您可以停用自动加载器。设置&#39; engine.autoloader.on&#39;为假。当然,当监视文件发生更改时,您将失去自动加载,因此您需要在每次更改时手动重新启动服务器。另一种方法是将服务器置于生产模式。查看可用模式及其执行的操作:http://docs.cherrypy.org/en/latest/config.html#id14

BTW:我看到类似的问题与cherrypy(13.0.0)和密码学(2.1.4)