Closed kalbermattenm closed 7 years ago
Can you try doing os.close(fd)
just before the rename? I think that will fix it. I don't have access to Windows myself, so I can't test that. The source should look like this:
(fd, tmpfile) = tempfile.mkstemp(dir=os.path.dirname(filename), text=True)
catalog.save(tmpfile)
os.close(fd)
os.rename(tmpfile, filename)
That did the trick, thanks ! I did not get that fd
was the file... sorry....
Do you want me to submit a PR ?
I already have a commit ready here; so there is no need to submit a PR. Thanks for the offer though! I am currently traveling, but will try to get a new release out soon.
On 7 Oct 2016, at 18:19, Michael Kalbermatten notifications@github.com wrote:
That did the trick, thanks ! I did not get that fd was the file... sorry....
Do you want me to submit a PR ?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
OK thanks a lot for the fix and the future release ! Safe travels ;-)
I updated lingua from version 4.6 to 4.9 (Python 2.7 on Windows 7) and since then it is not working correctly anymore.
I always get this error:
WindowsError: [Error 32] The process cannot access the file beacause it is being used by another process.
Apparently, the
tmpfile
is not correctly closed and the system still thinks the file is being used, thusos.rename
(https://github.com/wichert/lingua/blob/master/src/lingua/extract.py#L235) throws this error.Moreover, just before
os.rename
I tried that:And I get exactly the same error, but for the
f = open(tmpfile)
command...