Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
error loading email_adj plugin
#5
I found the problem:
Error: " 'dict' object has no attribute 'iteritems' "

iteritems() must be changed to items() in python3.

This change will fix the error for both email_adj.py and pressure_adj.py plugins.

But sms_adj.py and telegramBot.py still don't load after the fix above.

As a head-up, other files also need to be updated.

Below are candidates for updating:

pi@comitup-580:~/SIP $ grep -rw "iteritems" *
Binary file plugins/__pycache__/pump_control.cpython-37.pyc matches
plugins/pump_control.py: for key, value in file_data.iteritems():
plugins/telegramBot.py: for key, value in file_data.iteritems():
plugins/sms_adj.py: for key, value in file_data.iteritems():
plugins/pressure_adj.py: for key, value in file_data.iteritems():
six.py: def iteritems(d, **kw):
six.py: def iteritems(d, **kw):
six.py: return d.iteritems(**kw)
six.py:_add_doc(iteritems,
web/debugerror.py:$ newctx = [(k, v) for (k, v) in ctx.iteritems() if not k.startswith('_') and not isinstance(v, dict)]
web/template.py: self.iteritems = iter(items)
web/template.py: return next(self.iteritems)
Binary file web/__pycache__/application.cpython-37.pyc matches
Binary file web/__pycache__/py3helpers.cpython-37.pyc matches
Binary file web/__pycache__/debugerror.cpython-37.pyc matches
Binary file web/__pycache__/utils.cpython-37.pyc matches
Binary file web/__pycache__/session.cpython-37.pyc matches
Binary file web/__pycache__/template.cpython-37.pyc matches
Binary file web/__pycache__/db.cpython-37.pyc matches
Binary file web/__pycache__/http.cpython-37.pyc matches
web/utils.py: iteritems,
web/utils.py: for (key, value) in iteritems(defaults):
web/utils.py: return [k for k, v in iteritems(self) if v == m]
web/utils.py: return [k for k, v in iteritems(self) if v == m]
web/utils.py: return dict([(value, key) for (key, value) in iteritems(mapping)])
web/utils.py: for (key, value) in iteritems(dictionary):
web/utils.py: for (key, value) in iteritems(dictionary):
web/utils.py: >>> for t, v in iteritems({
web/utils.py: for (key, value) in iteritems(context):
web/utils.py: for (key, value) in iteritems(results):
web/utils.py: def iteritems(self):
web/utils.py: return iteritems(self.__dict__)
web/utils.py: for (key, value) in iteritems(locals):
web/utils.py: for k, v in iteritems(self.headers):
web/application.py:from .py3helpers import PY2, is_iter, iteritems, string_types
web/application.py: for k, v in iteritems(ctx):
web/session.py:from .py3helpers import PY2, iteritems
web/session.py: for k, (atime, value) in iteritems(self.d_store):
web/http.py:from .py3helpers import iteritems, numeric_types
web/http.py: for k, v in iteritems(kw):
web/db.py:from .py3helpers import PY2, iteritems, numeric_types, string_types, text_type
web/db.py: for k, v in sorted(iteritems(where), key=lambda t: t[0]):
web/py3helpers.py: iteritems = lambda d: d.iteritems()
web/py3helpers.py: iteritems = lambda d: iter(d.items())

Perhaps py3helper.py above takes care of this problem already via:
iteritems = lambda d: iter(d.items())

(2021 Sep 23, 02:25 PM)dan Wrote: Looks like the Encoders import should be:
Code:
from email import encoders
that is deprecated in Python3, see:
https://docs.python.org/3/library/email.encoders.html

You also need to change

# from email.MIMEMultipart import MIMEMultipart
# from email.MIMEBase import MIMEBase
# from email.MIMEText import MIMEText

to

from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email.mime.text import MIMEText

Dan

Hi Dan, 

The deprecated "Encoders" show up in two places in email_adj.py:

The second instance is at line # 234:

            Encoders.encode_base64(part)
Reply


Messages In This Thread
error loading email_adj plugin - by paul - 2021 Sep 23, 01:32 PM
RE: error loading email_adj plugin - by dan - 2021 Sep 23, 01:40 PM
RE: error loading email_adj plugin - by dan - 2021 Sep 23, 02:25 PM
RE: error loading email_adj plugin - by paul - 2021 Sep 23, 04:12 PM
RE: error loading email_adj plugin - by paul - 2021 Sep 24, 08:10 AM
RE: error loading email_adj plugin - by dan - 2021 Sep 25, 01:30 PM

Forum Jump:


Users browsing this thread: 4 Guest(s)