seeing the following AttributeError: 'IPAddress' object has no attribute 'encode' when moving to 2.0.1
saiaprameya opened this issue · comments
python3.8/site-packages/sh.py", line 2121, in
bytes_cmd = [c.encode(ca["encoding"]) for c in cmd]
AttributeError: 'IPAddress' object has no attribute 'encode'
Looks like you're passing in an IPAddress object to the command. Please show the full invocation of the sh command
Here it is:
from sh import ping
out = ping(['-c', '1', '-i', '1', IPAddress('10.104.237.139')])
type(out)
Yes you will want to make sure you're only passing basic types into your commands, so go ahead and convert the ip address to a string. I thought sh tried to coerce all objects to strings for you automatically though, so I will look into that.
Closing. Feel free to reopen if you still have issues with this.