Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reload: error with plugin whose file has moved #1761

Open
dgw opened this issue Nov 23, 2019 · 6 comments
Open

reload: error with plugin whose file has moved #1761

dgw opened this issue Nov 23, 2019 · 6 comments
Assignees
Labels
Bug Things to squish; generally used for issues Low Priority
Milestone

Comments

@dgw
Copy link
Member

dgw commented Nov 23, 2019

Upon realizing I had a reddit.py in /var/lib/sopel/modules that shadowed the built-in one (preventing me from seeing the effects of edits to it), I deleted the outdated file and attempted to reload reddit so I could get on with debugging & testing the issue at hand:

[2019-11-23 01:33:33,719] sopel.bot            INFO     - Unloaded plugin reddit
[2019-11-23 01:33:33,720] sopel.bot            ERROR    - Unexpected error ([Errno 2] No such file or directory: '/var/lib/sopel/modules/reddit.py') from dgw at 2019-11-23 01:33:33.719968. Message was: Kaede: reload reddit
Traceback (most recent call last):
  File "/home/dgw/sopel-dev/sopel/bot.py", line 533, in call
    exit_code = func(sopel, trigger)
  File "/home/dgw/sopel-dev/sopel/module.py", line 567, in guarded
    return function(bot, trigger, *args, **kwargs)
  File "/home/dgw/sopel-dev/sopel/modules/reload.py", line 48, in f_reload
    bot.reload_plugin(name)
  File "/home/dgw/sopel-dev/sopel/bot.py", line 257, in reload_plugin
    plugin.reload()
  File "/home/dgw/sopel-dev/sopel/plugins/handlers.py", line 370, in reload
    self._module = self._load()
  File "/home/dgw/sopel-dev/sopel/plugins/handlers.py", line 342, in _load
    with open(self.path) as mod:
FileNotFoundError: [Errno 2] No such file or directory: '/var/lib/sopel/modules/reddit.py'

Note that immediately saying Kaede: load reddit worked just fine. Clearly the plugin system can adapt, but maybe there's a race condition?

I've only seen this with a single-file plugin, but that's only because my Sopel bot doesn't have any directory-based plugins (I avoid writing them because of other known reloading problems). Presumably it affects any plugin, if the type changes (e.g. from a file in .sopel/modules to a submodule in sopel.modules.*)? Needs more testing, though preferably not at almost 01:00 local time. 😁

Assigning to the crazy Frenchman who wrote the new plugin handlers, since he'll be able to figure out where to start debugging faster than anyone else. 😛

@dgw dgw added Bug Things to squish; generally used for issues Low Priority labels Nov 23, 2019
@dgw dgw added this to the 7.0.0 milestone Nov 23, 2019
@dgw dgw modified the milestones: 7.0.0, 7.1.0 Dec 17, 2019
@dgw
Copy link
Member Author

dgw commented Dec 17, 2019

Punted, per IRC. This will allow time for Exirel to develop a better solution, without starting with a kludge first.

@Exirel
Copy link
Contributor

Exirel commented Jun 19, 2020

Months later, and I'm still not sure how to fix that exactly.

@Exirel
Copy link
Contributor

Exirel commented Dec 21, 2020

Yup, year later, still no idea how to approach that properly.

@dgw dgw modified the milestones: 7.1.0, 8.0.0 Feb 25, 2021
@dgw
Copy link
Member Author

dgw commented Feb 25, 2021

Let's revisit this after we drop old Python crap for 8.0. If enough EOL Python versions go away, this might be simpler.

@dgw
Copy link
Member Author

dgw commented Jun 22, 2021

Here again from the future, musing that #1695 is kind of related.

@dgw dgw removed this from the 8.0.0 milestone Jul 14, 2022
@dgw
Copy link
Member Author

dgw commented Jul 14, 2022

Going along with the other plugin-related wishlist stuff. Not sure when this might get worked on, but it remains a wishlist item and I would like to look at it again after 8.0.

@dgw dgw added this to the 8.1.0 milestone Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Things to squish; generally used for issues Low Priority
Projects
None yet
Development

No branches or pull requests

2 participants