Skip to content

Critical plugin series_premiere crash #2334

Closed
@lazylionsby

Description

@lazylionsby
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.

Activity

gazpachoking

gazpachoking commented on Feb 9, 2019

@gazpachoking
Member

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

gazpachoking commented on Feb 9, 2019

@gazpachoking
Member

Hmm, I've been trying to reproduce this by manually altering the import order of components, but can't seem to accomplish it.

gazpachoking

gazpachoking commented on Feb 9, 2019

@gazpachoking
Member

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

gazpachoking commented on Feb 9, 2019

@gazpachoking
Member

@lazylionsby Do you happen to still have a file at /usr/local/lib/python3.6/dist-packages/flexget/plugins/filter/series.py?

lazylionsby

lazylionsby commented on Feb 10, 2019

@lazylionsby
Author
lazylionsby

lazylionsby commented on Feb 10, 2019

@lazylionsby
Author

Is there a way to re-initialize the entire database?

lazylionsby

lazylionsby commented on Feb 10, 2019

@lazylionsby
Author

It's fixed:

  1. execute "sudo -H pip uninstall flexget" multiple times to remove all version
  2. remove ~/.flexget/db-config.sqlite
  3. reinstall flexget with pip
  4. Everything works now
cvium

cvium commented on Feb 10, 2019

@cvium
Contributor

I wouldn't consider deleting the db a fix

gazpachoking

gazpachoking commented on Feb 10, 2019

@gazpachoking
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Critical plugin series_premiere crash · Issue #2334 · Flexget/Flexget