[PATCH] D79802: Fixed a problem removing temp files

Pete Steinfeld via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 13 07:32:39 PDT 2020


PeteSteinfeld added a comment.

> I am not on Windows, so I can't reproduce this.  Would you be able to debug this so we understand what the problem is? For example, printing the exception object or looking into the error handler of `shutil.rmtree(... , onerror=..)` might shed light on things [1].

Here's what I've discovered.

Despite the `FIXME` comment, inserting a call to `sleep()` has no effect.

I printed out the exception object, and got the following:

'module' object has no attribute 'rmtree'

When I moved the call to `shutil.rmtree()` out of the try/exception block, I got a stack dump the message at the bottom:

NameError: global name 'shutil' is not defined

So the version of Python I'm using doesn't have `shutil`.  When I look up the documentation, it looks like it's been around since at least version 2.3, and I'm running version 2.7.1.  I also have version 3.6.7 on my machine, and when I upgraded to that version the problem went away.

I'm not sure what the best fix is here.  The simplest thing for me would be to
remove the `FIXME` comment and add some text to the warning message recommending that the user upgrade their version of Python if they see the message.

I put in such code and tested it under both Python 2.7.1 and 3.6.7, and it works for me.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79802/new/

https://reviews.llvm.org/D79802





More information about the llvm-commits mailing list