Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-21 Thread Srihari Vijayaraghavan
On 21 August 2015 at 02:57, Alan Gauld wrote: > On 20/08/15 09:51, Srihari Vijayaraghavan wrote: > >> In general I agree, but this is what the os.walk() document states: >> "... When topdown is True, the caller can modify the dirnames list >> in-place (perhaps using del or slice assignment)..." >

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Alan Gauld
On 20/08/15 09:51, Srihari Vijayaraghavan wrote: In general I agree, but this is what the os.walk() document states: "... When topdown is True, the caller can modify the dirnames list in-place (perhaps using del or slice assignment)..." That's true so far as the os.walk call goes. That is, alt

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
On 20 August 2015 at 18:51, Srihari Vijayaraghavan wrote: > On 20 August 2015 at 18:25, Alan Gauld wrote: >> On 20/08/15 04:03, Srihari Vijayaraghavan wrote: >> >>> out = sys.stdout.write >>> for root, dirs, files in os.walk("/"): >>> out("The dirs before removing mount points: %s\n" % dirs)

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
On 20 August 2015 at 18:25, Alan Gauld wrote: > On 20/08/15 04:03, Srihari Vijayaraghavan wrote: > >> out = sys.stdout.write >> for root, dirs, files in os.walk("/"): >> out("The dirs before removing mount points: %s\n" % dirs) >> for d in dirs: >> dname = os.path.join(root, d) >>

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Peter Otten
Laura Creighton wrote: > In a message of Thu, 20 Aug 2015 09:25:29 +0100, Alan Gauld writes: >> >>It always amazes me how often the same issues come up in >>rapid succession. We must have had 4 or 5 of these types >>of errors in the last couple of months, and other times >>we go for 6 months or mo

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Laura Creighton
In a message of Thu, 20 Aug 2015 09:25:29 +0100, Alan Gauld writes: > >It always amazes me how often the same issues come up in >rapid succession. We must have had 4 or 5 of these types >of errors in the last couple of months, and other times >we go for 6 months or more without it being raised! :-)

Re: [Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Alan Gauld
On 20/08/15 04:03, Srihari Vijayaraghavan wrote: out = sys.stdout.write for root, dirs, files in os.walk("/"): out("The dirs before removing mount points: %s\n" % dirs) for d in dirs: dname = os.path.join(root, d) if os.path.ismount(dname): dirs.remove(d) It

[Tutor] Request for help with os.walk() combining os.path.ismount() in Linux

2015-08-20 Thread Srihari Vijayaraghavan
Hello Folks, Please consider the following 2 scripts: 1. os_path_ismount.py: import os import sys out = sys.stdout.write out("%s\n" % os.path.ismount(sys.argv[1])) 2. os_walk.py: import sys import os out = sys.stdout.write for root, dirs, files in os.walk("/"): out("The dirs before removing mo