Author rubenlm
Recipients rubenlm
Date 2010-04-24.18:57:41
SpamBayes Score 1.26144e-11
Marked as misclassified No
Message-id <1272135463.46.0.698266589767.issue8523@psf.upfronthosting.co.za>
In-reply-to
Content
The code that lists directory contents in rmtree is:

try:
  names = os.listdir(path)
except os.error, err:
  onerror(os.listdir, path, sys.exc_info())

If there is an error there is nothing the "onerror" function can do to fix the problem because the variable "names" will not be updated after the problem is solved in "onerror".

Two possible solutions:

1 - Call os.listdir() again after onerror()

    try:
      names = os.listdir(path)
    except os.error, err:
      onerror(os.listdir, path, sys.exc_info())
      names = os.listdir(path)

2 - Allow onerror() to return a value and set "names" to that value.

    try:
      names = os.listdir(path)
    except os.error, err:
      names = onerror(os.listdir, path, sys.exc_info())
History
Date User Action Args
2010-04-24 18:57:43rubenlmsetrecipients: + rubenlm
2010-04-24 18:57:43rubenlmsetmessageid: <1272135463.46.0.698266589767.issue8523@psf.upfronthosting.co.za>
2010-04-24 18:57:42rubenlmlinkissue8523 messages
2010-04-24 18:57:41rubenlmcreate