gsutil CONFIG_REQUIRED导入错误?

时间:2013-09-17 17:48:20

标签: google-cloud-storage gsutil

我尝试安装并运行gsutil,但收到以下错误:

Traceback (most recent call last):
  File "/Users/groovebug/gsutil/gsutil", line 88, in <module>
    sys.exit(gslib.__main__.main())
  File "/Users/groovebug/gsutil/gslib/__main__.py", line 93, in main
    command_runner = CommandRunner(config_file_list)
  File "/Users/groovebug/gsutil/gslib/command_runner.py", line 102, in __init__
    self.command_map = self._LoadCommandMap()
  File "/Users/groovebug/gsutil/gslib/command_runner.py", line 112, in _LoadCommandMap
    __import__('gslib.commands.%s' % module_name)
  File "/Users/groovebug/gsutil/gslib/commands/disablelogging.py", line 18, in <module>
    from gslib.command import CONFIG_REQUIRED
ImportError: cannot import name CONFIG_REQUIRED

我重新安装并继续使用它,并且没有找到任何人在其他地方解决它。

3 个答案:

答案 0 :(得分:3)

gsutil不再使用该变量。如果您更新到最新版本的gsutil,则不再出现此问题:

gsuil update

答案 1 :(得分:0)

CONFIG_REQUIRED只是字典中使用的键的常量名称。

如果您打开$ {Directory_Containing_gsutil} /gsutil/gslib/command.py

并添加行

CONFIG_REQUIRED = 'config_required'

它解决了这个问题。不知道为什么缺少这条线。

答案 2 :(得分:0)

我今天收到了类似的错误。 用同样的方法。 所以这不奇怪。

    Traceback (most recent call last):
  File "/root/gsutil/gsutil", line 88, in <module>
    sys.exit(gslib.__main__.main())
  File "/root/gsutil/gslib/__main__.py", line 111, in main
    command_runner = CommandRunner(config_file_list)
  File "/root/gsutil/gslib/command_runner.py", line 104, in __init__
    self.command_map = self._LoadCommandMap()
  File "/root/gsutil/gslib/command_runner.py", line 110, in _LoadCommandMap
    __import__('gslib.commands.%s' % module_name)
  File "/root/gsutil/gslib/commands/test.py", line 39, in <module>
    from gslib.tests.util import GetTestNames
  File "/root/gsutil/gslib/tests/util.py", line 26, in <module>
    import unittest2 as unittest
ImportError: No module named unittest2