• 解决:File "/usr/lib/python2.7/site-packages/more_itertools/more.py", line 340 def _collate(*iterables, key=lambda a: a, reverse=False): 的报错


    cyberb commented on 15 Apr

    Traceback (most recent call last): 
    File "/snap/users/x1/python/bin/ldapcherryd", line 11, in <module> 
    load_entry_point('ldapcherry==1.1.1', 'console_scripts', 'ldapcherryd')() 
    File "/snap/users/x1/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 487, in load_entry_point 
    return get_distribution(dist).load_entry_point(group, name) 
    File "/snap/users/x1/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2728, in load_entry_point 
    return ep.load() 
    File "/snap/users/x1/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2346, in load 
    return self.resolve() 
    File "/snap/users/x1/python/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2352, in resolve 
    module = __import__(self.module_name, fromlist=['__name__'], level=0) 
    File "/snap/users/x1/python/lib/python2.7/site-packages/ldapcherry-1.1.1-py2.7.egg/ldapcherry/__init__.py", line 19, in <module> 
    from ldapcherry.exceptions import * 
    File "/snap/users/x1/python/lib/python2.7/site-packages/ldapcherry-1.1.1-py2.7.egg/ldapcherry/exceptions.py", line 9, in <module> 
    import cherrypy 
    File "/snap/users/x1/python/lib/python2.7/site-packages/CherryPy-17.4.1-py2.7.egg/cherrypy/__init__.py", line 66, in <module> 
    from ._cperror import ( 
    File "/snap/users/x1/python/lib/python2.7/site-packages/CherryPy-17.4.1-py2.7.egg/cherrypy/_cperror.py", line 129, in <module> 
    from more_itertools import always_iterable 
    File "build/bdist.linux-x86_64/egg/more_itertools/__init__.py", line 1, in <module> 
    File "/snap/users/x1/python/lib/python2.7/site-packages/more_itertools-7.0.0-py2.7.egg/more_itertools/more.py", line 333 
    def _collate(*iterables, key=lambda a: a, reverse=False): 
    ^ 
    SyntaxError: invalid syntax
    

    Maybe related to: https://stackoverflow.com/questions/54648246/invalid-syntax-in-more-itertools-when-running-pytest


    I can confirm that requiring a more-itertools dependency that is less than 6.0.0 is required to fix this issue when using Python 2. There is a python3 branch to LdapCherry, and I don't know if the migration is going to be soon, or if the maintainer plans to maintain two versions.

    @vishwakumba
     
     
     

    vishwakumba commented on 30 Apr

    I also obtained the same error while starting ldapcherry

    [root@ldapcherry scripts]# ldapcherryd -c /etc/ldapcherry/ldapcherry.ini -D
    Traceback (most recent call last):
    File "/bin/ldapcherryd", line 9, in
    load_entry_point('ldapcherry==1.1.1', 'console_scripts', 'ldapcherryd')()
    File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
    File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
    File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = import(self.module_name, globals(),globals(), ['name'])
    File "/usr/lib/python2.7/site-packages/ldapcherry/init.py", line 19, in
    from ldapcherry.exceptions import *
    File "/usr/lib/python2.7/site-packages/ldapcherry/exceptions.py", line 9, in
    import cherrypy
    File "/usr/lib/python2.7/site-packages/cherrypy/init.py", line 66, in
    from ._cperror import (
    File "/usr/lib/python2.7/site-packages/cherrypy/_cperror.py", line 129, in
    from more_itertools import always_iterable
    File "/usr/lib/python2.7/site-packages/more_itertools/init.py", line 1, in
    from more_itertools.more import * # noqa
    File "/usr/lib/python2.7/site-packages/more_itertools/more.py", line 333
    def _collate(*iterables, key=lambda a: a, reverse=False):
    ^
    SyntaxError: invalid syntax

    @vishwakumba
     
     
     

    vishwakumba commented on 30 Apr

     

    The foll. workaround seems to resolve this issue: (CentOS 7.2/Python 2.7.5 and ldapcherry 1.1.1)

    $ pip install 'more-itertools<=5.0.0'

    @smacz42
     
     
    Contributor

    smacz42 commented on 13 Jul

    This is the correct fix. This issue should be marked as closed.

  • 相关阅读:
    CTO这点事(技术,业务,管理,情商,周期,趋势)转
    Unit Test相关问题汇总
    优秀的命令行文件传输程序(转)
    ZOJ3329之经典概率DP
    Sql Server 2005 开发版亲測可用下载地址
    Hadoop与HBase中遇到的问题
    Struts2自己定义拦截器实例—登陆权限验证
    手游Apk破解疯狂,爱加密apk加固保护开发人员
    HighCharts 具体使用及API文档说明
    Linux(SLES)挂载NTFS移动硬盘实践
  • 原文地址:https://www.cnblogs.com/kaishirenshi/p/11820198.html
Copyright © 2020-2023  润新知