ITKeyword,专注技术干货聚合推荐

注册 | 登录

RDO Stack Exception: UnboundLocalError: local variable 'logFile' referenced before assignment

yexianyi 分享于 2016-02-13

推荐:【Python】UnboundLocalError: local variable 'l' referenced before assignment

01 在程序中设置的 sum_Logical 属于全局变量 , 而在函数 calculate 中没有 sum_Logical 的定义 , 根据 python 访问局部变量和全局变量的规则:当搜索一个变量的

2018阿里云全部产品优惠券(新购或升级都可以使用,强烈推荐)
领取地址https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=zo93kaue

Issue:

When you install RDO stack on CentOS, you may encounter following error.

Error:

[root@localhost ~]# packstack --allinone

ERROR:root:Failed to load plugin from file prescript_000.py

ERROR:root:Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/packstack/installer/run_setup.py", line 884, in loadPlugins

    moduleobj = __import__(moduleToLoad)

  File "/usr/lib/python2.7/site-packages/packstack/plugins/prescript_000.py", line 35, in <module>

    from packstack.modules.documentation import update_params_usage

  File "/usr/lib/python2.7/site-packages/packstack/modules/documentation.py", line 20, in <module>

    from docutils import core

  File "/usr/lib/python2.7/site-packages/docutils/core.py", line 20, in <module>

    from docutils import frontend, io, utils, readers, writers

  File "/usr/lib/python2.7/site-packages/docutils/frontend.py", line 41, in <module>

    import docutils.utils

  File "/usr/lib/python2.7/site-packages/docutils/utils/__init__.py", line 20, in <module>

    import docutils.io

  File "/usr/lib/python2.7/site-packages/docutils/io.py", line 18, in <module>

    from docutils.utils.error_reporting import locale_encoding, ErrorString, ErrorOutput

  File "/usr/lib/python2.7/site-packages/docutils/utils/error_reporting.py", line 46, in <module>

    locale_encoding = locale.getlocale()[1] or locale.getdefaultlocale()[1]

  File "/usr/lib64/python2.7/locale.py", line 511, in getdefaultlocale

    return _parse_localename(localename)

  File "/usr/lib64/python2.7/locale.py", line 443, in _parse_localename

    raise ValueError, 'unknown locale: %s' % localename

ValueError: unknown locale: UTF-8


ERROR:root:Traceback (most recent call last):

  File "/usr/lib/python2.7/site-packages/packstack/installer/run_setup.py", line 949, in main

    loadPlugins()

  File "/usr/lib/python2.7/site-packages/packstack/installer/run_setup.py", line 892, in loadPlugins

    raise Exception("Failed to load plugin from file %s" % item)

Exception: Failed to load plugin from file prescript_000.py



ERROR : Failed to load plugin from file prescript_000.py

Traceback (most recent call last):

  File "/usr/bin/packstack", line 15, in <module>

    run_setup.main()

  File "/usr/lib/python2.7/site-packages/packstack/installer/run_setup.py", line 1019, in main

    print(output_messages.ERR_CHECK_LOG_FILE_FOR_MORE_INFO % (logFile))

UnboundLocalError: local variable 'logFile' referenced before assignment


Solution:

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8


推荐:python:UnboundLocalError: local variable 'l' referenced before assignment

总结: 内部函数,不修改全局变量可以访问全局变量 内部函数,修改同名全局变量,则python会认为它是一个局部变量 在内部函数修改同名全局变量之前调用变量名称

Issue: When you install RDO stack on CentOS, you may encounter following error. Error: [root@localhost ~]# packstack --allinone ERROR:root:Failed to load plugin from file prescript

相关阅读排行


用户评论

游客

相关内容推荐

阿里云RDS

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。