[vtk-developers] Python Wrapping fails in master build.

David Gobbi david.gobbi at gmail.com
Fri Sep 28 11:01:22 EDT 2018


On Fri, Sep 28, 2018 at 8:32 AM David Gobbi <david.gobbi at gmail.com> wrote:

> On Thu, Sep 27, 2018 at 11:02 PM David Gobbi <david.gobbi at gmail.com>
> wrote:
>
>> Thanks, Andrew.  So now we know that errno is EACCES, which corresponds
>> to a Windows filesystem error of ERROR_ACCESS_DENIED
>> or ERROR_SHARING_VIOLATION.  I strongly suspect the latter.
>>
>> So there are two options:
>>
>> 1) retry a few times (e.g. 5 times over 5 seconds), in the hope that the
>> sharing violation will clear up, which it probably will because antivirus
>> software only takes a fraction of a second to scan a small file.
>>
>> 2) write to a temporary file which is then renamed to ..Python.cxx (in
>> which case the 'rename' operation has to retry if it encounters a sharing
>> violation).
>>
>> The latter is what CMake does (its "cmSystemTools::RenameFile()" function
>> retries, so cmake doesn't seem to have any magic that makes retries
>> unnecessary).
>>
>> I'm tempted to go with (1) due to its simplicity, and because if we used
>> a random temporary file we'd have to find some way to remove that file if
>> vtkWrapPython didn't exit cleanly.
>>
>
> Another option that might work:
>
> 3) If the output file already exists, then delete it with the Windows
> DeleteFile() function before calling fopen() to create a new file with the
> same name.
>

Or, if the above doesn't work, the following closely related trick might
work:

4) If the output file already exists, then rename it with MoveFile() and
delete the renamed file.  It should then be possible to call fopen() with
the proper name.

The hypothesis is that MoveFile() won't cause a sharing violation because
it has no impact on existing file handles.  This is just a hypothesis,
though, and my conceptions of how files should work is biased strongly
towards UNIX-like behavior.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://public.kitware.com/pipermail/vtk-developers/attachments/20180928/44b49463/attachment.html>


More information about the vtk-developers mailing list