Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unnecessary warning when closing a file #23

Open
marijnd opened this issue Sep 10, 2019 · 2 comments
Open

Unnecessary warning when closing a file #23

marijnd opened this issue Sep 10, 2019 · 2 comments

Comments

@marijnd
Copy link

marijnd commented Sep 10, 2019

When running a unittest on a piece of code that uses libCharon we get:

.../Charon/VirtualFile.py:50: ResourceWarning: unclosed file

Reason for this is that the testrunner run python with -W. I think the warning is invalid. Is there a way to prevent this warning?

@Ghostkeeper
Copy link
Contributor

The ResourceWarning most likely comes from zipfile.ZipFile, when you're closing a zip archive before all of the files within the archive have been closed?

@marijnd
Copy link
Author

marijnd commented Sep 11, 2019

I get it when I do this:

    f = VirtualFile()
    f.open("output.ufp")
    f.close()

If a file remains unclosed that should be handled by VirtualFile I think

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants