File tree 1 file changed +6
-4
lines changed
src/pip/_internal/network
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -51,17 +51,19 @@ def get_credential(
51
51
cls , service_name : str , username : Optional [str ]
52
52
) -> Optional [KeyRingCredential ]:
53
53
cmd = ["keyring" , "get" , service_name , str (username )]
54
- res = subprocess .run (cmd , capture_output = True )
54
+ res = subprocess .run (
55
+ cmd , capture_output = True , env = dict (PYTHONIOENCODING = "utf-8" )
56
+ )
55
57
if res .returncode :
56
58
return None
57
- password = res .stdout .decode ().strip ("\n " )
59
+ password = res .stdout .decode ("utf-8" ).strip ("\n " )
58
60
return KeyRingCredential (username = username , password = password )
59
61
60
62
@classmethod
61
63
def set_password (cls , service_name : str , username : str , password : str ) -> None :
62
64
cmd = ["keyring" , "set" , service_name , username ]
63
- input_ = password .encode () + b"\n "
64
- res = subprocess .run (cmd , input = input_ )
65
+ input_ = password .encode ("utf-8" ) + b"\n "
66
+ res = subprocess .run (cmd , input = input_ , env = dict ( PYTHONIOENCODING = "utf-8" ) )
65
67
res .check_returncode ()
66
68
return None
67
69
You can’t perform that action at this time.
0 commit comments