- 积分
- 16843
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
AttributeError: '_Environ' object has no attribute 'set'
w& m7 V) T! `Traceback (most recent call last):$ F9 P3 Q0 t+ L% H( a+ Y" Z
File "/usr/bin/gnocchi", line 10, in <module>3 F$ R; ]2 O6 Z# }. z" P3 s
sys.exit(main())
l9 R0 n. v2 @5 x7 F6 J: @3 G: a File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main
. ^+ G2 X: c* A) K8 p7 I return GnocchiShell().run(args)3 S, P8 w- }2 [2 r, V
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__
0 G* M1 W( s b' j! Q5 S* @3 K deferred_help=True,
% X$ s3 u- ^9 N. k S0 t0 z File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__1 k5 V! e' ^: T3 b. w& ^6 W7 H! x y
self.parser = self.build_option_parser(description, version)/ g5 H1 @+ b% M; i* h3 ?, K4 V$ r6 G
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser
2 l6 t% g+ F+ [& i% p! Q os.environ.set("OS_AUTH_TYPE", "password")0 i3 `9 V4 o% a# o4 s# J6 e- @3 w
AttributeError: '_Environ' object has no attribute 'set' o A& S4 K& M% Q/ l, @
7 c/ L6 r$ Y* J4 _总结出两个办法消除这个错误。) \$ h5 t3 ~' N$ g" S' {+ x
方法一:+ C I* ^4 m! U$ C5 U% [ ?
, U9 [' J# m2 c% Z4 S! E9 M+ v vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py8 ?8 z& f3 H9 a0 O& n
#将
+ Z1 p& q. V0 C: C( ^4 o
" E5 s% A7 L9 l7 u' ^) s # NOTE(jd) This is a workaroun for people using Keystone auth with the; ?' C' ? W& m% @
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
9 q& w* B/ @2 I5 L # assumes it is the default. It's not in that case, but since we can't7 X' _+ B" S; h5 C$ q
# fix all the rc files of the world, workaround it here.
% V. o( Z8 N A8 u- }0 v; R if ("OS_PASSWORD" in os.environ and3 h3 z t. G! g
"OS_AUTH_TYPE" not in os.environ):
# D- A: R$ n4 [: I& n. N os.environ.set("OS_AUTH_TYPE","password")
; I, b/ p i/ N#修改为
3 b( f, Z3 C4 e( m. N6 x
% w4 g! G% }) ~2 T5 R # NOTE(jd) This is a workaroun for people using Keystone auth with the
) ]6 y6 F) ^9 A' z, ?: k3 k$ m3 { # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and( c0 O- \$ [" t% i- R3 m+ a
# assumes it is the default. It's not in that case, but since we can't v" I- V0 y2 h8 u
# fix all the rc files of the world, workaround it here.
- s7 Y' q. G( L0 b5 C. h+ b! y if ("OS_PASSWORD" in os.environ and
( _6 v) M# u' c) c( ~: T3 Y "OS_AUTH_TYPE" not in os.environ):
* B$ X K3 q5 D# {, S8 ~1 L os.environ.setdefault("OS_AUTH_TYPE","password")
6 c2 G& v3 Z& |+ k$ o& A* N, X就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
: T& k4 _ t+ @" ]; z8 q. X方法二:; J8 x4 _5 M8 l9 S: r: w" S3 z, Q& _% l
#将
! E. ` w; v4 g; z: c/ w: V # NOTE(jd) This is a workaroun for people using Keystone auth with the
, s. y7 q k- Q # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
' q- z6 F+ Q' Q6 O* l # assumes it is the default. It's not in that case, but since we can't0 z! y1 f) r5 ^2 {1 y' i
# fix all the rc files of the world, workaround it here.7 S5 k4 q$ D- `' y0 Z
if ("OS_PASSWORD" in os.environ and3 n/ C7 c. z P! [. Q- V
"OS_AUTH_TYPE" not in os.environ):4 U# n* B5 H- d& A+ w1 `
os.environ.set("OS_AUTH_TYPE","password")
; g+ D+ L' P* D7 g5 ~#修改为) \" ^3 U6 R B
# NOTE(jd) This is a workaroun for people using Keystone auth with the
% y' c( `) a1 \; L! l7 | # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
/ C0 e3 w- w1 @& x2 ^& V # assumes it is the default. It's not in that case, but since we can't- w$ N# P, U U) E# x; }4 S2 x
# fix all the rc files of the world, workaround it here.
: q" q1 W8 N/ L% ^' u2 l5 \$ D if ("OS_PASSWORD" in os.environ and. Q" Z& [; L( l7 ]5 K
"OS_AUTH_TYPE" not in os.environ):7 W; l1 P3 B" C" H- k
os.environ["OS_AUTH_TYPE"]="password"3 e l( D. I7 O0 E
就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
: N3 I5 G t- D) r( G" A3 [以上两种方法供借鉴 @( k" y2 _/ p) U
# U& S& X0 c! }+ ^- S6 J) K |
|