[Tutor] glob paramiko
Matt Herzog
msh at blisses.org
Fri May 8 20:56:35 CEST 2009
On Fri, May 08, 2009 at 02:30:22PM -0400, Kent Johnson wrote:
> On Fri, May 8, 2009 at 1:04 PM, Matt Herzog <msh at blisses.org> wrote:
> > Hey All.
> >
> > All I need to do in this script is scp or sftp a bunch of files to a remote server. This script will run from a cron job eventually.
> >
> > For whatever reason, paramiko can't cope with a list.
> >
> > ---------------------------------------------------------------------------
> > AttributeError ? ? ? ? ? ? ? ? ? ? ? ? ? ?Traceback (most recent call last)
> >
> > /Users/msh/<ipython console> in <module>()
> >
> > AttributeError: 'NoneType' object has no attribute 'put'
>
> It would be helpful to see the full stack trace.
Here it is, unless I can give you something more verbose. Not sure how to produce "full stack trace."
Do you mean this: http://docs.python.org/library/traceback.html ?
(15)[datasvcs at iggy ~/AIG]$ ./parameek0.py
Traceback (most recent call last):
File "./parameek0.py", line 24, in ?
sftp.put(localpath, filepath)
File "build/bdist.linux-x86_64/egg/paramiko/sftp_client.py", line 547, in put
TypeError: coercing to Unicode: need string or buffer, list found
>
> > sftp = paramiko.SFTPClient.from_transport(transport)
> >
> > os.chdir("/home/fatcat/")
> > filepath = '/'
> > localpath = glob.glob("*.tab")
> > sftp.put(localpath, filepath)
>
> It looks like sftp is None. That is why it has no attribute "put".
Yeah, it shows up as a type list. I haven't been doing any python thinking in a couple months.
The script works without the glob syntax on a single file defined as:
localpath = '/home/foo/bar.txt'
Thanks for helping.
>
> Kent
--
I fear you speak upon the rack,
Where men enforced do speak anything.
- William Shakespeare
More information about the Tutor
mailing list