[GRASS-dev] os.remove
Paulo van Breugel
p.vanbreugel at gmail.com
Mon Mar 21 04:00:47 PDT 2016
On 21-03-16 10:12, Paulo van Breugel wrote:
> Hi devs,
>
> In the addon r.forestfrag (python script), I used os.remove() to
> remove some temporary files (in lines 230, 258 and 430). However, this
> fails in Windows, with an error message like below:
>
> WindowsError: [Error 32] The process cannot access the file because it
> is being used by another process:
> 'c:\\users\\uqdshana\\appdata\\local\\temp\\tmpwlv54l'
>
> Removing these lines with os.remove() solves the problem, but than the
> user is left with these temporary files. Is there a Window compatible
> way to remove them in the script?
Perhaps I should have looked harder first, the underlying problem
(described here: https://www.logilab.org/blogentry/17873) seems to be
that the file needs to be closed at OS level, which can be done using
os.close().
>
> Rgds
>
> Paulo
More information about the grass-dev
mailing list