- 积分
- 16840
在线时间 小时
最后登录1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?开始注册
x
AttributeError: '_Environ' object has no attribute 'set'
- S) @6 U7 W2 [6 y. c9 WTraceback (most recent call last):
# ?( |7 a7 q% a9 p, H% b u File "/usr/bin/gnocchi", line 10, in <module>3 j! Y9 {3 `5 \2 u& C: @. H
sys.exit(main())
1 c* q; z7 e+ x5 G5 B7 w T6 \ File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 252, in main+ j/ v5 k( t6 Q1 [9 K6 L, c5 S H
return GnocchiShell().run(args)3 l: f( b3 Y3 e& p, d. _. }
File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 99, in __init__8 A l- z# o+ i' s6 d! S. z' W6 B
deferred_help=True,
1 C# G& n; h2 Q7 ^) K: b5 f7 f8 } File "/usr/lib/python3.6/site-packages/cliff/app.py", line 85, in __init__2 t# ~# E/ E3 M, \, F7 {+ z
self.parser = self.build_option_parser(description, version)
* C) l6 R; z6 S. @6 l1 Q File "/usr/lib/python3.6/site-packages/gnocchiclient/shell.py", line 130, in build_option_parser$ X( {- m- X0 P1 V3 T
os.environ.set("OS_AUTH_TYPE", "password")
6 j% |, w- w) g' Q. y$ iAttributeError: '_Environ' object has no attribute 'set'
/ B$ I, F/ C. Q. O4 ?3 ?: u' D
; E) B6 A( T; M G, `, @5 C总结出两个办法消除这个错误。3 t2 A7 [% e1 H4 O
方法一:
$ Q" N# E- K' m- v D* I $ T$ { E7 I# u" K9 N8 h! }* O
vim /usr/lib/python2.7/site-packages/gnocchiclient/shell.py% h6 M% k) ]9 c4 m( ?- g: R
#将
* E; q/ H5 p% G, b( J/ V7 @1 f : u6 I1 r5 ^4 T y: L% @# g
# NOTE(jd) This is a workaroun for people using Keystone auth with the# z. g% A ^, J" e5 W w
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and5 E5 S- l8 i. l* O; C d& j% t$ t
# assumes it is the default. It's not in that case, but since we can't
$ r4 p" `5 M2 ? t # fix all the rc files of the world, workaround it here.
+ R. e/ ~3 H: [3 J# _ if ("OS_PASSWORD" in os.environ and
8 S1 q/ {6 q+ r" L# U "OS_AUTH_TYPE" not in os.environ):
% P& Q3 }* {; }6 s# P( }( M7 x# g: c os.environ.set("OS_AUTH_TYPE","password")7 S2 z! ]2 x& b. j
#修改为) a, s. p! o. r( y& g) c
: M4 h! e4 c( B) {+ o # NOTE(jd) This is a workaroun for people using Keystone auth with the" @& r3 v6 I5 Z
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
3 b5 J4 [ L: Q7 t2 J # assumes it is the default. It's not in that case, but since we can't
) K6 Z* W- W7 _$ E6 ~ # fix all the rc files of the world, workaround it here.6 f% o' z8 y( A7 X
if ("OS_PASSWORD" in os.environ and
, }/ y( r0 {2 X9 O' s8 s# c "OS_AUTH_TYPE" not in os.environ):0 i8 V% F* N3 W
os.environ.setdefault("OS_AUTH_TYPE","password")0 X: O) ~4 a: P. q. S8 Z8 R' q
就是将 os.environ.set("OS_AUTH_TYPE","password")修改为os.environ.setdefault("OS_AUTH_TYPE","password")
; z$ [. I7 a- q7 [7 h$ |方法二:+ M( H5 S# ^9 d& { Z+ o
#将
8 O5 s- Y3 p4 Y" B. m: W' _- a% ?6 K" a # NOTE(jd) This is a workaroun for people using Keystone auth with the
; I2 `* {9 h+ O T- F+ i% I # CLI. A lot of rc files do not export OS_AUTH_TYPE=password and3 s$ K; Q9 s1 Q7 j- H$ v! i+ n$ m
# assumes it is the default. It's not in that case, but since we can't
6 f8 I7 U9 O8 B$ ], M6 d; { # fix all the rc files of the world, workaround it here.
& Q, @8 L; v! j" Z' n if ("OS_PASSWORD" in os.environ and+ R0 {1 v/ L$ \
"OS_AUTH_TYPE" not in os.environ):8 N* ^8 {) P$ `4 ~9 x- K2 W
os.environ.set("OS_AUTH_TYPE","password")( S1 H& l2 @- r
#修改为
- M1 z4 N* l' X j) [ # NOTE(jd) This is a workaroun for people using Keystone auth with the, T5 R6 X6 |; X( U L* ?, B& H
# CLI. A lot of rc files do not export OS_AUTH_TYPE=password and
: u! L `5 U2 X' C4 d0 m! L3 O! d # assumes it is the default. It's not in that case, but since we can't
+ L5 i5 j" `* s/ x* [( {, n # fix all the rc files of the world, workaround it here.
2 V' k6 h* L, r* s- U e if ("OS_PASSWORD" in os.environ and3 p$ \; s4 {# j1 y- ?* K; O" O
"OS_AUTH_TYPE" not in os.environ):# E3 q/ i6 z1 h* C3 ?
os.environ["OS_AUTH_TYPE"]="password"4 ]! D8 P" Y1 M; g9 C$ ^. Z
就是将os.environ.set("OS_AUTH_TYPE","password")修改为os.environ["OS_AUTH_TYPE"]="password"
* U C, v) C& L; k/ Z4 k) F. ^以上两种方法供借鉴
6 _- X$ S5 @6 [! r. ~& L
+ u# b$ [! ]3 x1 B9 q |
|