Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MagicException: regex error #276

Closed
shurkam opened this issue Aug 1, 2022 · 1 comment · May be fixed by #294
Closed

MagicException: regex error #276

shurkam opened this issue Aug 1, 2022 · 1 comment · May be fixed by #294

Comments

@shurkam
Copy link

shurkam commented Aug 1, 2022

Windows Server 2016, Python 10.0
python-magic 0.4.27
python-magic-bin 0.4.14

Code:

import magic

def main():
    ft = magic.Magic()
    file = 'memblock.h'
    r = ft.from_file(file)
    print(r)

if __name__ == '__main__':
    main()

Exception raised:

Traceback (most recent call last):
  File "c:\win-checkout\dev1.py", line 10, in <module>
    main()
  File "c:\win-checkout\dev1.py", line 6, in main
    r = ft.from_file(file)
  File "c:\Python3\lib\site-packages\magic\magic.py", line 91, in from_file
    return self._handle509Bug(e)
  File "c:\Python3\lib\site-packages\magic\magic.py", line 100, in _handle509Bug
    raise e
  File "c:\Python3\lib\site-packages\magic\magic.py", line 89, in from_file
    return maybe_decode(magic_file(self.cookie, filename))
  File "c:\Python3\lib\site-packages\magic\magic.py", line 255, in magic_file
    return _magic_file(cookie, coerce_filename(filename))
  File "c:\Python3\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)"

The problematic file attached (extension changed to txt).
memblock.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants