Checking type of command to only encode if string.

This commit is contained in:
Keoni Mahelona 2020-03-04 21:47:06 +13:00 committed by Kyle Robbertze
parent 348f8573c7
commit d48e792922
1 changed files with 3 additions and 1 deletions

View File

@ -265,7 +265,9 @@ class TelnetLiquidsoap:
tn = telnetlib.Telnet(self.ls_host, self.ls_port)
for i in commands:
self.logger.info(i)
tn.write(i.encode('utf-8'))
if type(i) is str:
i = i.encode('utf-8')
tn.write(i)
tn.write('exit\n'.encode('utf-8'))
tn.read_all().decode('utf-8')