changing the working directory

Yes, we currently do that. But if an error is raised

    > before the cleanup can occur, then several files are left
    > behind. If I happen to be viewing the contents of the
    > current directory with a modern file manager, I see all
    > these temporary files popping up and then disappearing. I
    > guess there is nothing to be done about it.

Can you not try/except the errant code and perform the cleanup in the
except branch?

JDH