> On Dec 4, 2018, at 12:05, Asad <asad.hasan2...@gmail.com> wrote: > > Hi All , > > I am not allowed to import pexcept .Therefore only option I > have is to implement a solution using the standard libraries in python .
I’m only suggesting it because it’s an easier way to interface with expect. If you aren’t allowed to install it, then we’ll stop talking about it. > However I am using subprocess.Popen for sftp I am unable to > pass the password. > You still are not understanding my point. using sftp in batch mode CAN’T USE a password. If you look at the manpage for sftp, batch mode prohibits it. -b batchfile Batch mode reads a series of commands from an input batchfile instead of stdin. Since it lacks user interaction it should be used in conjunction with non-inter‐ active authentication. <<————— “non-interactive authentication” means you must use an ssh key to authenticate instead of a password. In other words, trying to figure out how to send a login to the subprocess is not the issue; even if you can, it won’t work because sftp *in batch mode* will not accept it. If you _can’t_ set up an ssh key for this access, then you MUST stop trying to use batch mode, because it will never work. > Here I am unable to proceed , I am sure someone would have cracked this > problem earlier if they can share the code There is no code for this because it is not possible to do within the constraints you have proposed up to this point. 1. Can you set up ssh key passwordless authentication? if yes, then do it and what you have now will start working if no, then you can’t use sftp the way you are currently trying (the -b “batch mode”) and find a different solution (expect, here docs, etc). — David Rock da...@graniteweb.com _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor