Changes between Version 1 and Version 2 of Ticket #3567, comment 3
- Timestamp:
- 11/14/2022 03:45:10 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #3567, comment 3
v1 v2 3 3 https://stackoverflow.com/questions/66908593/oserror-winerror-87-the-parameter-is-incorrect 4 4 5 5 6 {{{ 7 Old Code (Causes OS Error 87) 8 Example code: 9 10 11 from fabric import task,SerialGroup,Connection 12 import os 13 14 USERNAME = os.getenv('USERNAME') 15 my_hosts = ["hostname"] 16 c = Connection(host="rg@host.com",connect_kwargs={"password":"abcd"}) 17 @task 18 def test(c): 19 print(USERNAME) 20 c.run("echo hello") 21 22 }}} 23 24 Then fixing: 25 26 {{{ 27 New code (no causes OS Error 87) 28 Example Code 29 Remplace to new code: 30 31 from fabric import task,SerialGroup,Connection 32 import os 33 34 USERNAME = os.getenv('USERNAME') 35 my_hosts = ["hostname"] 36 c = Connection(host="rg@host.com",connect_kwargs={"password":"abcd"}) 37 @task 38 def test(c): 39 print(USERNAME) 40 c.run("echo hello", replace_env=False) 41 42 }}} 6 43 7 44 … … 11 48 Apparently, it shows up with Python 3.8 or 3.9, but not with 3.6 or 3.7. 12 49 13 To get around it, you can use: c.run("echo hello", replace_env=False)50 To get around it, you can use: '''c.run("echo hello", replace_env=False)''' 14 51 15 52 This is OK for local calls, but can be problematic for remote calls, because it means that the remote session will see all environment variable values (some of which may be sensitive) of your local session. 16 53 17 54 18 }}}19 55