Closed owainkenwayucl closed 2 years ago
Oh, as an aside, -l debug
didn't seem to result in getting any debug logging inside load()
but honestly I haven't worked out why (this is why I had to resort to print()
statements).
The os.listdir
is based on the inode values I believe, so not random. I do recall a bug in the past where import of pylast, an optional dep, was not handled correctly. Looks like it was fixed in 0.9, based on release notes. https://eyed3.readthedocs.io/en/latest/history.html#v0-9-2020-01-01-favorite-thing
I recently upgraded the version of Ubuntu on one of my machines to 20.04 and eye3D from apt (0.8.10-1.1) started printing this error when I ran it:
(I know that you can't be expected to support distribution provided packages but the issue is present in the current version in this repository too)
That's fine, because I don't have pylast installed. But that got me wondering - I have another machine with exactly the same version of the package/OS and it does not get the error.
I spent a long time digging about in the code/installed packages/looking in strace without much result until I installed eyeD3 on a third machine which also gave the error. In desperation I added some
print()
statements toeyed3/plugins/__init__.py
) and discovered that on each machine it was testing a different set of the plugin files.The heuristic seems to be:
os.listdir
on the plugin directoryThe problem is that the result of
os.listdir
is random and machine specific (https://docs.python.org/3/library/os.html#os.listdir). This means the order thateye3d.plugins
tests the validity of plugin is system/installation specific. The end result on some machines without pylast they will reliably throw the error, on others they reliably won't. Indeed the output ofos.listdir
is in a different order for each of the three machines I tested it on, it just happens that sometimes "Classic" is before "lastfm" and sometimes it's after.I don't know whether you consider this a bug or not (I would consider random behaviour undesirable but it's your package!), but modifying the call to
sorted(os.listdir(d))
of course makes the behaviour reproducible everywhere.