ResourceWarning: unclosed file #8998
Unanswered
erkib
asked this question in
Question & Answer
Replies: 2 comments
-
@erkib Can you check in your code that the file has been closed after you have finished with upload. This warning is coming from the Cpython code. See here |
Beta Was this translation helpful? Give feedback.
0 replies
-
I'm using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Python: 3.8.16
Django: 4.2.1
DRF: 3.14.0
When using ModelSerializer with FileField on Model and doing file upload with DRF, in the end of tests it shows:
...
OK
Destroying test database for alias 'default'...
sys:1: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/xxx/SourceCode/private/xxx/_local/mediafiles/user_1/profile/xxx.png'>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Beta Was this translation helpful? Give feedback.
All reactions