Skip to content

FITS I/O, WINDOWS only: files remain open despite the use of "with" statement #7404

@matteobachetti

Description

@matteobachetti

In this PR on another package:
discos/srt-single-dish-tools#91
I'm getting a failure in Appveyor:

>           os.unlink(dst)
E           PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\appveyor\\AppData\\Local\\Temp\\1\\srttools-test-wx27cxl4\\Lib\\site-packages\\dummyfile.fits'

However, dummyfile.fits should not be open. All I/O on that file with astropy.io.fits.open() is through with statements and this call to unlink is in a function called outside of them, so the file should be closed when it gets to that function.
Has anyone gotten the same error?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions