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

ResourceWarning: unclosed file <_io.BufferedWriter #843

Open
mingdh opened this issue Sep 12, 2020 · 0 comments
Open

ResourceWarning: unclosed file <_io.BufferedWriter #843

mingdh opened this issue Sep 12, 2020 · 0 comments

Comments

@mingdh
Copy link

mingdh commented Sep 12, 2020

There is warning from python,
newspaper/utils.py:238: ResourceWarning: unclosed file <_io.BufferedWriter name='/var/****/.newspaper_scraper/feed_category_cache/4493fab35f9369455967c00969619b802f1a2559'>
pickle.dump(result, open(filepath, "wb"))

it seems that you open file, but not closed.
Is it ok to change the following code?

... and save the cached object for next time

with open(filePath,'wb') as f:
pickle.dump(result, f)

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

1 participant