You could use the subprocess module to run the relevant system commands.
More info on running sftp non-interactively (i.e from a script) can be
found here: http://fixunix.com/ssh/238284-non-interactive-sftp-put.html
Regards
Peter Lavelle
___
Tutor ma
johan=accesstel.com...@python.org] On Behalf Of Sander
Sweers
Sent: Saturday, 18 July 2009 1:43 AM
To: Matt Herzog
Cc: Python List
Subject: Re: [Tutor] sftp get single file
2009/7/17 Matt Herzog :
> Hello All.
>
> I need to use paramiko to sftp get a single file from a remote server.
> The r
On Mon, Jul 20, 2009 at 05:26:09PM -0500, Wayne wrote:
> On Mon, Jul 20, 2009 at 5:18 PM, Matt Herzog wrote:
>
> > On Mon, Jul 20, 2009 at 11:57:57PM +0200, Sander Sweers wrote:
> > > Please reply to the list.
> > >
> > > 2009/7/20 Matt Herzog :
> > > > Yeah. I have no idea if I am able to do thi
On Mon, Jul 20, 2009 at 5:18 PM, Matt Herzog wrote:
> On Mon, Jul 20, 2009 at 11:57:57PM +0200, Sander Sweers wrote:
> > Please reply to the list.
> >
> > 2009/7/20 Matt Herzog :
> > > Yeah. I have no idea if I am able to do this. The jail makes it
> ambiguous.
> >
> > There is no difference, the
On Mon, Jul 20, 2009 at 11:57:57PM +0200, Sander Sweers wrote:
> Please reply to the list.
>
> 2009/7/20 Matt Herzog :
> > Yeah. I have no idea if I am able to do this. The jail makes it ambiguous.
>
> There is no difference, the jail just moves the root directory as seen
> by the client.
>
> Di
Please reply to the list.
2009/7/20 Matt Herzog :
> Yeah. I have no idea if I am able to do this. The jail makes it ambiguous.
There is no difference, the jail just moves the root directory as seen
by the client.
Did you do as suggested earlier to use listdir()? This will tell you
how paramiko s
2009/7/20 Matt Herzog :
> remotepath = 'datestr'
Ok, you are now making a string.
> remotepath = datestr
Like Kent wrote the datestr can include other characters. So I would
try "/%Y%m%d.tab".
> sftp.get(remotepath, localpath)
> File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py", line
If I change
remotepath = 'datestr'
to
remotepath = datestr
I get:
sftp.get(remotepath, localpath)
File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py", line 587, in get
IOError: [Errno 21] Is a directory: '/tmp/testor/'
So remotepath is really more like a path + filname.
So I ne
2009/7/20 Matt Herzog :
> The file is there. I can sftp it using fugu.
I am sure it is but paramiko can't find it.
> The path is /20090720.tab since the file lives in a jail.
Issue a sftp.listdir() and see what paramiko sees on the remote server.
Greets
Sander
__
On Mon, Jul 20, 2009 at 11:02:52PM +0200, Sander Sweers wrote:
> 2009/7/20 Matt Herzog :
> > Traceback (most recent call last):
> > ??File "./scpgetter.py", line 20, in ?
> > ?? ?? ??sftp.get(remotepath, localpath)
> > ?? ?? ?? ??File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py",
> > lin
2009/7/20 Matt Herzog :
> Traceback (most recent call last):
> File "./scpgetter.py", line 20, in ?
> sftp.get(remotepath, localpath)
> File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py", line 584,
> in get
> File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py
On Mon, Jul 20, 2009 at 10:22:37PM +0200, Sander Sweers wrote:
> I do not know paramiko but looking over the client documentations...
>
> 2009/7/20 Matt Herzog :
> > if __name__ == "__main__":
> >t = paramiko.Transport((hostname, port))
> >t.connect(username=username, password=password)
>
I do not know paramiko but looking over the client documentations...
2009/7/20 Matt Herzog :
> if __name__ == "__main__":
>t = paramiko.Transport((hostname, port))
>t.connect(username=username, password=password)
>sftp = paramiko.SFTPClient.from_transport(t)
Up to here it looks fine.
On Fri, Jul 17, 2009 at 12:12:52PM -0400, Kent Johnson wrote:
> On Fri, Jul 17, 2009 at 11:42 AM, Sander Sweers
> wrote:
>
> > import time
> >
> > today = time.localtime()
> > datestr = time.strftime("%Y%m%d",today)
> > ext = ".tab"
> >
> > print datestr + ext
>
> You can include literal charact
On Fri, Jul 17, 2009 at 11:42 AM, Sander Sweers wrote:
> import time
>
> today = time.localtime()
> datestr = time.strftime("%Y%m%d",today)
> ext = ".tab"
>
> print datestr + ext
You can include literal characters in the format string:
In [4]: time.strftime("%Y%m%d.tab",today)
Out[4]: '20090717.
2009/7/17 Matt Herzog :
> Hello All.
>
> I need to use paramiko to sftp get a single file from a remote server.
> The remote file's base name will be today's date (%Y%m%d) dot tab.
> I need help joining the today with the .tab extension. Do I need globbing?
>
> example: 20090716.tab
>
> #!/usr/bin/
16 matches
Mail list logo