- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
AttributeError: '_Environ' object has no attribute 'set'
' q5 e9 B0 K- ?2 {Traceback (most recent call last):, m( j. F `, k- k
File "/usr/bin/gnocchi", line 10, in <module>
( A; |" B; S* U# h! A8 Q9 I sys.exit(main())$ h0 y" {: P @* h' n" \0 v7 H
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main- }8 l% t; N+ `+ F S' d
return GnocchiShell().run(args)7 h- }2 I7 ^1 J( i( V
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__# }: e; |0 v; }. T
deferred_help=True,% t0 N8 m8 |+ ?/ b5 z( `
File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__
- A, p( b, v' t. {1 a self.parser = self.build_option_parser(description, version)
- I" d5 ^1 D7 M! ~ File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser, d$ z& u" R* |8 M/ l
os.environ.set("OS_AUTH_TYPE", "password")
/ A0 G6 r4 k* l8 C. `7 J2 e( u0 KAttributeError: '_Environ' object has no attribute 'set'
9 S& j! s) L% X. g, v1 [2 j( S8 [0 W
总结出两个办法消除这个错误。
4 P' M1 W. {6 z% Q% j0 ~方法一:( `- s$ K8 F( A7 {/ d2 \+ T0 |
" ?. t4 M, Z: Y: k2 X; W0 Y6 q
vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py
) w" @$ w4 e8 G4 p# q( w' }1 t& M#将
2 m0 N3 v+ x4 {7 g: @+ Z 5 O o4 N$ `1 j9 S5 u9 F- U
# NOTE(jd) This is a workaroun for people using Keystone auth with the
' X- N6 g) {% e L. | # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
0 _$ @. F# G3 r1 c: ` # assumes it is the default. It's not in that case, but since we can't- R: s# a# `% Q: V# K& d w7 Y
# fix all the rc files of the world, workaround it here.# z! d. L# K3 S/ ~' Q, q; R" g. J
if ("OS_PASSWORD" in os.environ and8 V5 @ ~: F: T7 n
"OS_AUTH_TYPE" not in os.environ):
6 c% ]6 S0 D- d4 U6 t os.environ.set("OS_AUTH_TYPE","password"): N9 H8 p$ i }8 G2 k
#修改为
2 T$ Y7 T- V9 f: }, R
$ [+ S( s# K% j' M% X: I5 h. m( T3 s7 i # NOTE(jd) This is a workaroun for people using Keystone auth with the" g4 K3 w! R& @+ n ?
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
- c/ q0 N' v7 P S+ o9 L8 a) z # assumes it is the default. It's not in that case, but since we can't7 ^- x- o$ q- n% y9 @
# fix all the rc files of the world, workaround it here.
( ~; j/ N4 w7 i# }7 ` if ("OS_PASSWORD" in os.environ and
1 ^ b" u) e: n3 E6 k: D- g9 P "OS_AUTH_TYPE" not in os.environ):: n7 W# N& S: T% @$ }
os.environ.setdefault("OS_AUTH_TYPE","password")
7 n9 | ^5 O3 @2 S, y; Z, V就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
4 p8 P7 _6 T1 S方法二:* z9 g6 y% C: q; I. n0 I! v$ `
#将* I7 b; G* Y- z+ J* O
# NOTE(jd) This is a workaroun for people using Keystone auth with the
9 q( o y. E: F# {$ _ # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
1 Z. d' G' q2 h% d # assumes it is the default. It's not in that case, but since we can't
) d" C; j/ D+ ~7 O, C # fix all the rc files of the world, workaround it here.: @/ e# y1 Q) y2 u
if ("OS_PASSWORD" in os.environ and; S! j/ U5 U4 S. e
"OS_AUTH_TYPE" not in os.environ):0 F. F+ \# l* S }
os.environ.set("OS_AUTH_TYPE","password")
% T% `9 s) w2 O#修改为
5 ^. j5 {8 `; B: d3 k6 U$ _- s # NOTE(jd) This is a workaroun for people using Keystone auth with the
, u+ P9 ]0 \, [6 D" F1 o' ] # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and- {7 X/ x. ^+ L# p
# assumes it is the default. It's not in that case, but since we can't) O% C2 W6 O' R3 e
# fix all the rc files of the world, workaround it here.
4 F/ }" b0 P+ a if ("OS_PASSWORD" in os.environ and
- @* ^' n3 K7 o2 Z X" l2 P f7 o "OS_AUTH_TYPE" not in os.environ):5 ~/ |' G. c0 ^+ k: G
os.environ["OS_AUTH_TYPE"]="password"
+ q/ v% p0 f; O! m就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
/ v6 L0 f7 X1 ]1 w+ [以上两种方法供借鉴% P1 M; O; n) V7 B
5 L& @# T" Y8 Q) _/ C6 ^" v
|
|