New submission from Vajrasky Kok:
[sky@localhost cpython]$ cat /tmp/a.txt
x-application/mimea mimea
application/mimeb mimeb
[sky@localhost cpython]$ cat /tmp/a.py
import warnings
warnings.simplefilter('default')
import mimetypes
mimetypes.read_mime_types('/tmp/a.txt')
[sky@localhost cpython]$ python3 /tmp/a.py
/tmp/a.py:7: ResourceWarning: unclosed file <_io.TextIOWrapper
name='/tmp/a.txt' mode='r' encoding='UTF-8'>
mimetypes.read_mime_types('/tmp/a.txt')
Attached the patch to fix the resource warning problem.
----------
components: Library (Lib)
files: fix_resource_warning_read_mime_types.patch
keywords: patch
messages: 194557
nosy: vajrasky
priority: normal
severity: normal
status: open
title: Using read_mime_types function from mimetypes module gives resource
warning
type: resource usage
versions: Python 3.4
Added file:
http://bugs.python.org/file31176/fix_resource_warning_read_mime_types.patch
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18670>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com