hi, On Sat, Jan 14, 2017 at 3:16 PM, Mini Trader <miniflowtra...@gmail.com> wrote:
> Well the author at my request was able to remove the call to os.getcwd() > which allows the program to operate. > > > If anyone wants to tinker here is an example that will likely break on > someones system. I don't know if this is an LX bug, libc bug, python bug > etc. > > # read a directory, stat all files > > import os > import sys > from stat import * > > def chdir(d): > global cwdlist > > if d != '.': > os.chdir(d) > if d == '..': > cwdlist.pop() > else: > cwdlist.append(d) > print repr('/'.join(cwdlist)) > # Comment the line below to allow things to run > os.getcwd() > > def walk(d): > chdir(d) > dirlist = os.listdir('.') > dirlist.sort() > for f in dirlist: > try: > s = os.lstat(f) > if S_ISDIR(s.st_mode): > walk(f) > except OSError, err: > print err > chdir('..') > > if len(sys.argv) != 2: > print 'need 1 arg, directory to scan' > > os.chdir(sys.argv[1]) > cwd = os.getcwd() > cwdlist = cwd.split('/') > > walk('.') > > runs fine in a centos 6.8 container, no problem. I even have a couple of mount points with several thousand files and it walks everything without a hitch. -- regards, Natxo
_______________________________________________ OmniOS-discuss mailing list OmniOS-discuss@lists.omniti.com http://lists.omniti.com/mailman/listinfo/omnios-discuss