python ldaptor inmemory语法错误

李贞焕
Traceback (most recent call last):
  File "OpenLdapServer.py", line 6, in <module>
  from ldaptor.inmemory import fromLDIFFile
  File "C:\Users\RnD_01\AppData\Local\Programs\Python\Python36-32\lib\site-packages\ldaptor-16.0.0-py3.6.egg\ldaptor\inmemory.py", line 59
  raise ldaperrors.LDAPEntryAlreadyExists, self._children[rdn_str].dn
                                        ^
  SyntaxError: invalid syntax

我不知道为什么会出现语法错误。

小D

问题是ldaptor不支持python3,它是用python2写的,你试图在python 3环境中运行代码,python 2和3中raise异常的语法是不同的:

蟒蛇2:

raise IOError, "file error"

或者

raise IOError("file error")

蟒蛇3:

raise IOError("file error")

请参考本期:https : //github.com/twisted/ldaptor/issues/55

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章