CherryPy Autoloader 死于 bcrypt
CherryPy Autoloader dies with bcrypt
我在 CherryPy 上有纯项目,希望 AuthTool 使用 bcrypt 模块进行密码处理。
但是当我将 "import 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
在那之后一切正常,但自动加载器。我有 bcrypt (3.1.4) 和 CherryPy (11.1.0)。
我可以做些什么来解决这个自动加载器的问题吗?谢谢
您可以禁用自动加载器。将 'engine.autoloader.on' 设置为 False。当然,当监视的文件发生更改时,您将失去自动加载,因此您需要在每次更改时手动重新启动服务器。另一种方法是将服务器置于生产模式。查看可用模式及其作用:http://docs.cherrypy.org/en/latest/config.html#id14
顺便说一句:我发现 cherrypy (13.0.0) 和密码学 (2.1.4) 存在类似问题
我在 CherryPy 上有纯项目,希望 AuthTool 使用 bcrypt 模块进行密码处理。
但是当我将 "import 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
在那之后一切正常,但自动加载器。我有 bcrypt (3.1.4) 和 CherryPy (11.1.0)。
我可以做些什么来解决这个自动加载器的问题吗?谢谢
您可以禁用自动加载器。将 'engine.autoloader.on' 设置为 False。当然,当监视的文件发生更改时,您将失去自动加载,因此您需要在每次更改时手动重新启动服务器。另一种方法是将服务器置于生产模式。查看可用模式及其作用:http://docs.cherrypy.org/en/latest/config.html#id14
顺便说一句:我发现 cherrypy (13.0.0) 和密码学 (2.1.4) 存在类似问题