ImportError:没有名为sapi的模块

时间:2018-07-10 14:20:42

标签: python redhat

我正在RedHat 7盒子上安装ViewVC。当我尝试转到网页http:/// viewvc时,出现500 Internal Server Error。在httpd日志(/ var / log / httpd / error_log)中,出现以下错误:

错误:无法在/ var / lib / rpm中打开Packages数据库 追溯(最近一次通话): 在第56行的文件“ /var/www/cgi-bin/viewvc.cgi” 导入sapi ImportError:没有名为sapi的模块 标头之前的脚本输出结束:viewvc.cgi

viewvc.cgi脚本是:

    #!/usr/bin/python
    # -*-python-*-
    #
    # Copyright (C) 1999-2017 The ViewCVS Group. All Rights Reserved.
    #
    # By using this file, you agree to the terms and conditions set forth in
    # the LICENSE.html file which can be found at the top level of the ViewVC
    # distribution or at http://viewvc.org/license-1.html.
    #
    # For more information, visit http://viewvc.org/
    #
    # -----------------------------------------------------------------------
    #
    # viewvc: View CVS/SVN repositories via a web browser
    #
    # -----------------------------------------------------------------------
    #
    # This is a teeny stub to launch the main ViewVC app. It checks the load
    # average, then loads the (precompiled) viewvc.py file and runs it.
    #
    # -----------------------------------------------------------------------
    #

    #########################################################################
    #
    # INSTALL-TIME CONFIGURATION
    #
    # These values will be set during the installation process. During
    # development, they will remain None.
    #

    LIBRARY_DIR = r"/usr/local/viewvc-1.1.26/lib"
    CONF_PATHNAME = r"/usr/local/viewvc-1.1.26/viewvc.conf"

    #########################################################################
    #
    # Adjust sys.path to include our library directory
    #

    import sys
    import os

    if LIBRARY_DIR:
        sys.path.insert(0, LIBRARY_DIR)
    else:
       sys.path.insert(0, os.path.abspath(os.path.join(sys.argv[0],
                                                      "../../../lib")))

    #########################################################################

    ### add code for checking the load average

    #########################################################################

    # go do the work
    import sapi
    import viewvc

    server = sapi.CgiServer()
    cfg = viewvc.load_config(CONF_PATHNAME, server)
    viewvc.main(server, cfg)

任何帮助将不胜感激。

谢谢

0 个答案:

没有答案