[Tutor] string formatting

Mike mike at froward.org
Wed Oct 24 22:11:49 CEST 2012

I'm in the process of learning python and migrating away from bash 
scripting. I'm in the process of converting my bash scripts that 
essentially ssh to another host via shared keys, execute commands 
remotely, and exit. To do this I started using paramiko but eventually 
decided to do it w/ subprocess since I am more familiar with that as a 
result of me converting other scripts.

This is what I'm currently working on, the purpose of this is to ssh 
into another machine, make a tarball of dumped .sql files, save the 
tarball with the result of timestamp() as the naming convention, then it 
will eventually clean it up based on file age:


This is the result after executing the script:

rev at omega:~/code/beavis/test$ ls
bleh1.sql  bleh2.sql  bleh3.sql  ssh-jobs.py

rev at omega:~/code/beavis/test$ ./ssh-jobs.py
tar: Removing leading `/' from member names
tar: /home/rev/code/beavis/test/24.10.2012: Cannot stat: No such file or 
tar: 15\:06\:52.tgz: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
rev at omega:~/code/beavis/test$

As you can see it looks like its having issues with the way I'm using 
timestamp() for string formatting, as far as I can tell it is not a tar 
specific problem? Any help/insight on this would be greatly appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20121024/6c3808d7/attachment.html>

More information about the Tutor mailing list