Closed
Description
2019-02-09 14:21 CRITICAL plugin Exception while loading plugin flexget.components.series.series_premiere
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/flexget/plugin.py", line 392, in _import_plugin
__import__(module_name)
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/series_premiere.py", line 8, in <module>
from . import series as plugin_series
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/series.py", line 25, in <module>
from . import db
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/db.py", line 56, in <module>
class Series(Base):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/api.py", line 65, in __init__
_as_declarative(cls, classname, cls.__dict__)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 88, in _as_declarative
_MapperConfig.setup_mapping(cls, classname, dict_)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 116, in setup_mapping
cfg_cls(cls_, classname, dict_)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 144, in __init__
self._setup_table()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 437, in _setup_table
**table_kw)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/schema.py", line 438, in __new__
"existing Table object." % key)
sqlalchemy.exc.InvalidRequestError: Table 'series' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.
Traceback (most recent call last):
File "/usr/local/bin/flexget", line 10, in <module>
sys.exit(main())
File "/usr/local/lib/python3.6/dist-packages/flexget/__init__.py", line 42, in main
manager.start()
File "/usr/local/lib/python3.6/dist-packages/flexget/manager.py", line 363, in start
self.initialize()
File "/usr/local/lib/python3.6/dist-packages/flexget/manager.py", line 221, in initialize
extra_components=[os.path.join(self.config_base, 'components')],
File "/usr/local/lib/python3.6/dist-packages/flexget/plugin.py", line 497, in load_plugins
_load_components_from_dirs(extra_components)
File "/usr/local/lib/python3.6/dist-packages/flexget/plugin.py", line 448, in _load_components_from_dirs
_import_plugin(package_name, component_path)
File "/usr/local/lib/python3.6/dist-packages/flexget/plugin.py", line 392, in _import_plugin
__import__(module_name)
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/series_premiere.py", line 8, in <module>
from . import series as plugin_series
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/series.py", line 25, in <module>
from . import db
File "/usr/local/lib/python3.6/dist-packages/flexget/components/series/db.py", line 56, in <module>
class Series(Base):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/api.py", line 65, in __init__
_as_declarative(cls, classname, cls.__dict__)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 88, in _as_declarative
_MapperConfig.setup_mapping(cls, classname, dict_)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 116, in setup_mapping
cfg_cls(cls_, classname, dict_)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 144, in __init__
self._setup_table()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/ext/declarative/base.py", line 437, in _setup_table
**table_kw)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/schema.py", line 438, in __new__
"existing Table object." % key)
sqlalchemy.exc.InvalidRequestError: Table 'series' is already defined for this MetaData instance. Specify 'extend_existing=True' to redefine options and columns on an existing Table object.
Metadata
Metadata
Assignees
Labels
No labels
Activity
gazpachoking commentedon Feb 9, 2019
This looks similar to #2328. I'm thinking that something to do with the component change makes this happen. My suspicion is that how we are importing plugins causes the db.py file to be imported twice, instead of looked up in sys.modules the second time like it should be.
gazpachoking commentedon Feb 9, 2019
Hmm, I've been trying to reproduce this by manually altering the import order of components, but can't seem to accomplish it.
Switch from __import__ to importlib for plugin loading. refs #2334
gazpachoking commentedon Feb 9, 2019
So, I don't actually think that latest commit will fix anything, but it's the 'right way' to do imports as of python 2.7, so I figured we switch to in now with the glimmer of a hope it might fix this issue.
gazpachoking commentedon Feb 9, 2019
@lazylionsby Do you happen to still have a file at
/usr/local/lib/python3.6/dist-packages/flexget/plugins/filter/series.py
?lazylionsby commentedon Feb 10, 2019
series.zip
lazylionsby commentedon Feb 10, 2019
Is there a way to re-initialize the entire database?
lazylionsby commentedon Feb 10, 2019
It's fixed:
cvium commentedon Feb 10, 2019
I wouldn't consider deleting the db a fix
gazpachoking commentedon Feb 10, 2019
Sounds like it wasn't the database delete that fixed it. Seems the old series.py was leftover in the plugins directory after the upgrade. I cannot fathom why this would have happened, though we have had instances of such leftovers throughout the life of the project.