Error iterating files in directories
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 304
- PR merge metrics
- No merged PRs in 30d
Description
When I iterate over files to get their MIME type the magic library is able to provide the MIME type of some of the files and then it will through an error:
File "C:\Users\Chad\AppData\Local\Programs\Python\Python310\lib\site-packages\magic\magic.py", line 89, in from_file
return maybe_decode(magic_file(self.cookie, filename))
File "C:\Users\Chad\AppData\Local\Programs\Python\Python310\lib\site-packages\magic\magic.py", line 255, in magic_file
return magic_file(cookie, coerce_filename(filename))
File "C:\Users\Chad\AppData\Local\Programs\Python\Python310\lib\site-packages\magic\magic.py", line 196, in errorcheck_null
raise MagicException(err)
magic.magic.MagicException: b"line I64u: regex error 14 for `^[[:space:]]*class[[:space:]]+[[:digit:][:alpha:]:]+[[:space:]]\{(.[\n])\}(;)?$', (failed to get memory)"
PS C:\Users\Chad\Documents\GitHub\Python_practice_scripts>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the directory iteration failure through magic.py: from_file at line 89, magic_file at line 255, and errorcheck_null at line 196. Compare files that succeed with the file that triggers the libmagic regex error; done means the failure is understood and MIME-type iteration has a verified outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100