Closed FriedrichFroebel closed 2 years ago
while this appeared in the Python 3 version only and I am not able to tell you which configuration change suddenly brought this warning up
These warnings were added in Python 3.2: https://bugs.python.org/issue10093
While these warnings might have been added in Python 3.2, I have used the same Python virtualenv for the whole refactoring. It seems like nose has been hiding them, while the stdlib unittest test runner reports them by default. Nevertheless, this specific aspect should be (at least partially) independent from the actual issue and just becomes relevant when trying to reproduce the actual warning message.
These warnings are not shown by default. But unittest enables them since Python 3.2: https://bugs.python.org/issue10535
Thanks for the explanations - now it makes sense for me why these warnings have appeared.
Fixed in 6d9bd4a9cbf882d88d5a76bd4d6217c22f72f169.
When doing some tests refactoring on my Python 3 fork of this project, I stumbled upon some Python warning regarding unclosed files which appeared to not be referenced any more:
The issue seems to be that the corresponding method loads the image using PIL at the beginning (
pil_image = PIL.open(filename)
), but does not seem to be required any more after having passed it into the corresponding Gamera loader methods. Just callingpil_image.close()
at the end of the moment seems to fix this - at least all existing tests still pass.Please note that while this appeared in the Python 3 version only and I am not able to tell you which configuration change suddenly brought this warning up, I had a look at the offending code as well and assume that correctly closing the file there should make sense for the Python 2 case as well.