I have a device connected to my PC on Ethernet port. I want to connect to that via FTP and send few commands. It works very well with command prompt but python script is giving some exceptions.

My code is something like this:

import sys
from ftplib import FTP

try:
ftps=FTP('10.9.66.92')
print('connected')
ftps.login('user', 'pwd')
ftps.sendcmd('help')
except:
print(sys.exc_info())

it gives an exception while sending the command. connection and login is successful. I am able to get the welcome message also.

Please help.