You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shows that python-magic looks for magic.mgc in /home/linuxbrew/.linuxbrew/Cellar/, which doesn't exist:
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
stat("/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/loader.py", {st_mode=S_IFREG|0644, st_size=1168, ...}) = 0
stat("/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/loader.py", {st_mode=S_IFREG|0644, st_size=1168, ...}) = 0
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__pycache__/loader.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/dev/null", O_RDWR|O_CLOEXEC) = 3
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3321003, si_uid=85916, si_status=0, si_utime=0, si_stime=0} ---
stat("/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/compat.py", {st_mode=S_IFREG|0644, st_size=8316, ...}) = 0
stat("/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/compat.py", {st_mode=S_IFREG|0644, st_size=8316, ...}) = 0
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__pycache__/compat.cpython-39.pyc", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/dev/null", O_RDWR|O_CLOEXEC) = 3
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3321015, si_uid=85916, si_status=0, si_utime=0, si_stime=0} ---
stat("/home/infres/ext-8972/.magic.mgc", 0x7ffc2287d510) = -1 ENOENT (No such file or directory)
stat("/home/infres/ext-8972/.magic", 0x7ffc2287d510) = -1 ENOENT (No such file or directory)
access("/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic.mime.mgc", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", 0x7ffc2287d4f0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/infres/ext-8972/.magic.mgc", 0x7ffc2287d510) = -1 ENOENT (No such file or directory)
stat("/home/infres/ext-8972/.magic", 0x7ffc2287d510) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", 0x7ffc2287d4f0) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/infres/ext-8972/.magic.mgc", 0x7ffc2287f990) = -1 ENOENT (No such file or directory)
stat("/home/infres/ext-8972/.magic", 0x7ffc2287f990) = -1 ENOENT (No such file or directory)
access("/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic.mime.mgc", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic.mgc", O_RDONLY) = -1 ENOENT (No such file or directory)
stat("/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", 0x7ffc2287f970) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/linuxbrew/.linuxbrew/Cellar/libmagic/5.39/share/misc/magic", O_RDONLY) = -1 ENOENT (No such file or directory)
Traceback (most recent call last):
File "<string>", line 1, in <module>
openat(AT_FDCWD, "<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python39.zip/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python3.9/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python3.9/lib-dynload/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/infres/ext-8972/swh-environment/swh-dataset/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/infres/ext-8972/swh-environment/swh-journal/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/infres/ext-8972/swh-environment/swh-graph/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/lib/python3.9/dist-packages/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/lib/python3/dist-packages/<string>", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
File "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", line 73, in __init__
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", O_RDONLY|O_CLOEXEC) = 3
magic_load(self.cookie, magic_file)
File "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", line 332, in magic_load
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", O_RDONLY|O_CLOEXEC) = 3
return _magic_load(cookie, coerce_filename(filename))
File "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", line 225, in errorcheck_negative_one
openat(AT_FDCWD, "/home/infres/ext-8972/.local/lib/python3.9/site-packages/magic/__init__.py", O_RDONLY|O_CLOEXEC) = 3
raise MagicException(err)
magic.MagicException: b'could not find any valid magic files!'
+++ exited with 1 +++
while, without the scancode import, /usr/share/misc/magic.mime.mgc is found successfully:
@progval Thanks for the detailed report. Kudos for the strace output!
So clearly typecode-libmagic==5.39.210531 and python-magic compete for attention and whichever gets imported first loads libmagic first and get a first cut at loading a magic library. AFAICR python-magic likely looks for default locations and fails as the ones provided in the pre-built are not "standard" (and not used by ScanCode FWIW since we load a well-known magic database also provided by the plugin).
There is a way for ScanCode to reuse the system-installed libmagic instead of using the typecode-libmagic plugin-provided one that should come handy for this.
Hi,
I'd like to use both python-magic and scancode in the same process; but importing scancode first prevents python-magic from finding its files:
shows that python-magic looks for
magic.mgc
in/home/linuxbrew/.linuxbrew/Cellar/
, which doesn't exist:while, without the scancode import,
/usr/share/misc/magic.mime.mgc
is found successfully:this is on Debian 11. Python package versions:
The text was updated successfully, but these errors were encountered: