Unicode filenames make Yapsy fail to load things
A fat-free DIY Python plugin management toolkit.
Brought to you by:
tibonihoo
In Nikola, with latest Yapsy, this happens:
(nikola)ralsina@yoga:~/Desktop/proyectos/nikola/master/foo$ nikola auto Traceback (most recent call last): File "/home/ralsina/.virtualenvs/nikola/bin/nikola", line 9, in <module> load_entry_point('Nikola==7.4.1', 'console_scripts', 'nikola')() File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/__main__.py", line 152, in main site = Nikola(**config) File "/home/ralsina/Desktop/proyectos/nikola/master/nikola/nikola.py", line 692, in __init__ self.plugin_manager.collectPlugins() File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/yapsy/PluginManager.py", line 539, in collectPlugins self.locatePlugins() File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/yapsy/PluginManager.py", line 442, in locatePlugins self._candidates, npc = self.getPluginLocator().locatePlugins() File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/yapsy/PluginFileLocator.py", line 432, in locatePlugins plugin_info = self._getInfoForPluginFromAnalyzer(analyzer, dirpath, filename) File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/yapsy/PluginFileLocator.py", line 386, in _getInfoForPluginFromAnalyzer plugin_info_dict,config_parser = analyzer.getInfosDictFromPlugin(dirpath, filename) File "/home/ralsina/.virtualenvs/nikola/local/lib/python2.7/site-packages/yapsy/PluginFileLocator.py", line 266, in getInfosDictFromPlugin raise ValueError("Missing *name* of the plugin in extracted infos.") ValueError: Missing *name* of the plugin in extracted infos.
I have traced this inside yapsy and found _extractCorePluginInfo which does this:
if not isinstance(filename, str): # filename is a file object: use it name, moduleName, config_parser = self.getPluginNameAndModuleFromStream(filename)
And so, if filename is unicode, it will fail to parse the plugin.
Anonymous
That's very strange, the latest version of yapsy has a specific test for that and it seems to pass (in test_plugininfofilelocator.py).
Can you confirm that this happens with yapsy 1.11.123 ? And can you confirm that the path is a unicode instance ?
By the way in the latest sources, the faulty line in your stack reads isinstance(filename, basestring) instead of isinstance(filename,str).
Can you confirm the version of yapsy you're using (hopefully I didn't mess up theupload to pypi) ?
We had a user reporting the same issue with Err.
I've been able to confirm that the latest version on PyPI (1.11.123) fixes it, HOWEVER, this version doesn't get installed by recent versions of pip unless you specifically attempt to install it with
pip install 1.11.123b
.Presumably this happens because the releases were uploaded with a
b
suffix. Any chance the release on PyPI could get fixed? It might be sufficient to re-upload without theb
suffix, or perhaps just make a new release entirely.yep, I've just done it right now. Sorry for the long wait.
No worries, thanks a lot for the prompt release!