Message292995
The documentation for mimetypes.guess_type says that it “guesses the type of a file based on its filename or URL”.
However, this function only accepts a string object, and not a bytes object:
>>> import os
>>> import mimetypes
>>> mimetypes.guess_type(os.listdir(os.fsencode('./'))[0])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/mimetypes.py", line 291, in guess_type
return _db.guess_type(url, strict)
File "/usr/lib/python3.7/mimetypes.py", line 116, in guess_type
scheme, url = urllib.parse.splittype(url)
File "/usr/lib/python3.7/urllib/parse.py", line 924, in splittype
match = _typeprog.match(url)
TypeError: cannot use a string pattern on a bytes-like object |
|
Date |
User |
Action |
Args |
2017-05-04 16:08:06 | Valentin.Lorentz | set | recipients:
+ Valentin.Lorentz |
2017-05-04 16:08:06 | Valentin.Lorentz | set | messageid: <1493914086.8.0.9964529869.issue30268@psf.upfronthosting.co.za> |
2017-05-04 16:08:06 | Valentin.Lorentz | link | issue30268 messages |
2017-05-04 16:08:06 | Valentin.Lorentz | create | |
|