Title: mimetypes.guess_extension : AttributeError: 'NoneType' object has no attribute 'lower' · Issue #96264 · python/cpython · GitHub
Open Graph Title: mimetypes.guess_extension : AttributeError: 'NoneType' object has no attribute 'lower' · Issue #96264 · python/cpython
X Title: mimetypes.guess_extension : AttributeError: 'NoneType' object has no attribute 'lower' · Issue #96264 · python/cpython
Description: Hi, when i call the function "guess_extension" from the mimetypes module, i get an error : Traceback (most recent call last): File "
Open Graph Description: Hi, when i call the function "guess_extension" from the mimetypes module, i get an error : Traceback (most recent call last): File "
X Description: Hi, when i call the function "guess_extension" from the mimetypes module, i get an error : Traceback (most recent call last): File "<stdin>", line 1, in <module> Fil...
Opengraph URL: https://github.com/python/cpython/issues/96264
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mimetypes.guess_extension : AttributeError: 'NoneType' object has no attribute 'lower'","articleBody":"Hi, when i call the function \"guess_extension\" from the mimetypes module, i get an error : \r\n```\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/home/hg/Bureau/ezConverter/module.py\", line 14, in getRealExtension\r\n currentext = mime.guess_extension(x[0])\r\n File \"/usr/lib/python3.9/mimetypes.py\", line 326, in guess_extension\r\n return _db.guess_extension(type, strict)\r\n File \"/usr/lib/python3.9/mimetypes.py\", line 192, in guess_extension\r\n extensions = self.guess_all_extensions(type, strict)\r\n File \"/usr/lib/python3.9/mimetypes.py\", line 171, in guess_all_extensions\r\n type = type.lower()\r\nAttributeError: 'NoneType' object has no attribute 'lower'\r\n```\r\n\r\nI dont think it's my code. But it is here : \r\n```\r\nimport mimetypes as mime\r\ndef getRealExtension(filename):\r\n x = mime.guess_type(filename)\r\n currentext = mime.guess_extension(x[0])\r\n# I import it to the shell and call the function.\r\n```\r\nThanks in advance !","author":{"url":"https://github.com/HGStyle","@type":"Person","name":"HGStyle"},"datePublished":"2022-08-25T11:30:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/96264/cpython/issues/96264"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:96c80c8c-d19c-7938-6d92-26468d530f8e |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CF7C:EFB79:908658:C125AE:6969BF40 |
| html-safe-nonce | 8dc819b2b0e6f034ff4dc7346c6d2929a4b7ae9bfa250730aa7bdd6ac0360c14 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRjdDOkVGQjc5OjkwODY1ODpDMTI1QUU6Njk2OUJGNDAiLCJ2aXNpdG9yX2lkIjoiMTk0NzM2Mzk1NjQ2MzYxNTgwOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6b5e8c363fe4732f2ae64905a02c9d00062fae3154ee7948fa6228ff4bef32fd |
| hovercard-subject-tag | issue:1350753133 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/96264/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c74f5d6f58efb6817371ecb2c65f21abeee94180816408382b3edee4ac650440/python/cpython/issues/96264 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c74f5d6f58efb6817371ecb2c65f21abeee94180816408382b3edee4ac650440/python/cpython/issues/96264 |
| og:image:alt | Hi, when i call the function "guess_extension" from the mimetypes module, i get an error : Traceback (most recent call last): File " |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | HGStyle |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width