Re: [Tutor] Nested for loops, possibly?

2015-02-06 Thread Bob Williams
>>>>>>> def main(): print("Backing up ", src_path, >>>>>>> "/Documents\n", sep='') do_sync(doc_srcpath, >>>>>>> doc_syncpath) create_snaps(doc_syncpath, doc_snappath) >>>>>>> print("

Re: [Tutor] Nested for loops, possibly?

2015-02-05 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/02/15 14:59, DaveA wrote: > > > On February 5, 2015 8:27:29 AM EST, Bob Williams > wrote: >> Hi, >> >> My script is running under Python 3.4.1 on a 64bit openSUSE >> linux system. It is a backup scrip

Re: [Tutor] Nested for loops, possibly?

2015-02-05 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/02/15 13:57, Mark Lawrence wrote: > On 05/02/2015 13:27, Bob Williams wrote: > >> >> I would like to reduce all those repeated calls to do_sync() in >> main(), for example, to one by putting the *_srcpath and >&

[Tutor] Nested for loops, possibly?

2015-02-05 Thread Bob Williams
n) print("\nAll backups completed.") print("\nUnmounting backup drive.\n") subprocess.call(['umount', mnt_path]) print("\n>>> Please power down the Quad external drive enclosure <<<\n") if __name__ == "__main__":

Re: [Tutor] subprocess.call not formatting date

2014-07-08 Thread Bob Williams
t;/home/bob/A3/docsnaps", name) subprocess.call( > ["btrfs", "subvolume", "snapshot", "/home/bob/A3/documents", > destpath]) Thank you. That worked perfectly. Once it's pointed out it is obvious to use the python solution, but my brain is becoming les

[Tutor] subprocess.call not formatting date

2014-07-08 Thread Bob Williams
ell=True) File "/usr/lib64/python2.7/subprocess.py", line 522, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib64/python2.7/subprocess.py", line 658, in __init__ raise TypeError("bufsize must be an integer") TypeError: bufsize must be an i

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread Bob Williams
ge, ShowMeDo etc. > > But I thought the tutor list readers might be an interesting source > of alternatives that I hadn't thought of, or even heard of. > > All contributions considered :-) > Python Module of the Week <http://pymotw.com/2/> Bob - -- Bob Williams System: L

Re: [Tutor] code review

2014-06-11 Thread Bob Williams
benefit. Others can ignore the thread if they wish. Bob - -- Bob Williams System: Linux 3.11.10-11-desktop Distro: openSUSE 13.1 (x86_64) with KDE Development Platform: 4.13.1 Uptime: 06:00am up 3 days 11:36, 3 users, load average: 0.05, 0.03, 0.05 -BEGIN PGP SIGNATURE- Version:

Re: [Tutor] Logical error?

2014-05-03 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Steven, On 03/05/14 02:53, Steven D'Aprano wrote: > Hi Bob, and welcome! > > My responses interleaved with yours, below. > > On Fri, May 02, 2014 at 11:19:26PM +0100, Bob Williams wrote: >> -BEGIN PGP SIGNED MESSAGE

[Tutor] Logical error?

2014-05-02 Thread Bob Williams
ests that the first 'if' clause (matching the first 10 characters of the last line) is satisfied, but the second one isn't, as the flow jumps to the second 'else' clause. As the script runs without complaint, this is presumably a logical error rather than a syntax error,

Re: [Tutor] Slices of lists of lists

2014-03-28 Thread Bob Williams
My first > guess was that standard slice notation on the first index would do it, > but it doesn't! Instead, we get the rows again: > > In [6]: l[:][0] > Out[6]: [11, 12, 13] > > In [7]: l[:][1] > Out[7]: [21, 22, 23] > Jose, Just for clarity, are you trying to acces

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/02/14 15:41, Bob Williams wrote: On 26/02/14 05:31, Cameron Simpson wrote: >>> linkName1 = pathList[j][0:-3] + "mp3" >>> >>> Isn't this exactly the same as pathList[j] ? >>> > Actually

Re: [Tutor] Editing values from a dictionary

2014-02-26 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 26/02/14 17:29, Ben Finney wrote: > Bob Williams writes: > >> In [3]: print metadata["artist"] [u'The Incredible String Band'] >> >> I now want to pass that string to another program, but I want to &

[Tutor] Editing values from a dictionary

2014-02-26 Thread Bob Williams
gs[key] File "/usr/lib/python2.7/site-packages/mutagen/_vorbis.py", line 184, in __getitem__ if not values: raise KeyError, key KeyError: 'date' If it's possible to edit the string value that gets passed to subprocess.call('lame'...) - see problem #1 above, wou

Re: [Tutor] os.symlink can't find target

2014-02-26 Thread Bob Williams
05:31, Cameron Simpson wrote: > Hi Bob, > [...] > > The other things are just script remarks, not directly related to > your problem: > > On 24Feb2014 16:07, Bob Williams > wrote: >> if pathList[j][-3:] == "mp3": > > This is often written (I'

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24/02/14 16:56, Mark Lawrence wrote: > On 24/02/2014 16:36, Peter Otten wrote: >> Bob Williams wrote: >> [...] >>> Thanks, >> >> os.symlink(existing_file, symlink_to_create) >> >> fails with that e

Re: [Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
> Peter, Many thanks. I was fixating on the existing_file, not realising I had to create a home for the symlink first. > try: os.makedirs(os.path.dirname(symlink_to_create)) except OSError > as err: # Assume the directory exists. # A thorough coder would > check the errno here pass Rega

[Tutor] os.symlink can't find target

2014-02-24 Thread Bob Williams
paths in manually. I have tried escaping the spaces with '\', but the same error is generated. The file "/home/bob/music/artists/Death in June/1995 Rose Clouds Of Holocaust/10 Lifebooks.mp3" definitely exists. Thanks, Bob - -- Bob Williams System: Linux 3.11.10-7-desktop Distr

Re: [Tutor] Recommendation For A Complete Noob

2014-02-12 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 12/02/14 00:58, Dave Angel wrote: > Bob Williams Wrote in message: > > >> to slice those lines to get the artist and album names into a >> list. >> >> So far, so good but my output contains duplicates, so my fi

Re: [Tutor] Recommendation For A Complete Noob

2014-02-11 Thread Bob Williams
m names into a list. So far, so good but my output contains duplicates, so my final task is to work out how to get rid of them. You may find me popping up here again in a few days ;-) Good luck. Bob - -- Bob Williams System: Linux 3.11.10-7-desktop Distro: openSUSE 13.1 (x86_64) with KDE Developme