[Tutor] sftp using subprocess

Asad asad.hasan2004 at gmail.com
Tue Dec 4 13:05:33 EST 2018


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 .

            However I am using subprocess.Popen for sftp I am unable to
pass the password.

I tried the following :

>>> import subprocess
>>> subprocess.Popen(['sftp','username at server.com', 'stop'],
stdin=PIPE).communicate(input='abc')


Enter password for username
Password:

  Here I am unable to proceed , I am sure someone would have cracked this
problem earlier if they can share the code

Thanks in advance,       .

On Tue, Dec 4, 2018 at 10:30 PM <tutor-request at python.org> wrote:

> Send Tutor mailing list submissions to
>         tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>         tutor-request at python.org
>
> You can reach the person managing the list at
>         tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
> Today's Topics:
>
>    1. Re: sftp using subprocess (Alan Gauld)
>
>
>
> ---------- Forwarded message ----------
> From: Alan Gauld <alan.gauld at yahoo.co.uk>
> To: tutor at python.org
> Cc:
> Bcc:
> Date: Tue, 4 Dec 2018 08:41:03 +0000
> Subject: Re: [Tutor] sftp using subprocess
> On 04/12/2018 06:25, Asad wrote:
>
> > Permission denied (keyboard-interactive,publickey,password).
> > Connection closed
> >
> > Is there any other way to acheive this because I cannot import pexcept
> > module .
>
> That looks like the problem that David already highlighted
> with sftp.
>
> When you say you cannot import pexpect, is that because
> you are not allowed to? Or because of some technical issue?
> If so what? We might be able to help fix that.
>
> Also, you do realize that pexpect is not part of the
> standard library? You need to install it first.
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> https://mail.python.org/mailman/listinfo/tutor
>


-- 
Asad Hasan
+91 9582111698


More information about the Tutor mailing list