Greetings! I've been working on converting Bodhi to Python 3 today, and in doing so I'd like to run Bodhi's tests on Python 3 in Koji. Bodhi imports pylibravatar which imports DNS. Koji does not have an /etc/resolv.conf, which leads to an error, and the error handler does something that seems to be unfriendly in Python 3 land: /usr/lib/python3.6/site-packages/DNS/Base.py:53: in ParseResolvConf with open(resolv_path, 'r') as stream: E FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf' During handling of the above exception, another exception occurred: /usr/lib/python3.6/site-packages/py/_path/local.py:668: in pyimport __import__(modname) bodhi/tests/server/__init__.py:26: in <module> from bodhi.server.models import ( bodhi/server/models.py:45: in <module> from bodhi.server import bugs, buildsys, log, mail, notifications, Session, util bodhi/server/mail.py:30: in <module> from bodhi.server.util import get_rpm_header bodhi/server/util.py:38: in <module> import libravatar /usr/lib/python3.6/site-packages/libravatar.py:27: in <module> import DNS /usr/lib/python3.6/site-packages/DNS/__init__.py:37: in <module> Base._DiscoverNameServers() /usr/lib/python3.6/site-packages/DNS/Base.py:88: in _DiscoverNameServers return ParseResolvConf() /usr/lib/python3.6/site-packages/DNS/Base.py:56: in ParseResolvConf warnings.warn(e) E TypeError: expected string or bytes-like object It probably just needs an str() around the e on line 56 of Base.py. The upstream for this project seems to be dead, which is why I decided to report it here.
Here is a simple reproducer: $ sudo mv /etc/resolv.conf /etc/resolv.conf.bak $ $ python3 Python 3.6.4 (default, Mar 13 2018, 18:16:01) [GCC 7.3.1 20180130 (Red Hat 7.3.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import DNS Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/DNS/Base.py", line 53, in ParseResolvConf with open(resolv_path, 'r') as stream: FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.6/site-packages/DNS/__init__.py", line 37, in <module> Base._DiscoverNameServers() File "/usr/lib/python3.6/site-packages/DNS/Base.py", line 88, in _DiscoverNameServers return ParseResolvConf() File "/usr/lib/python3.6/site-packages/DNS/Base.py", line 56, in ParseResolvConf warnings.warn(e) TypeError: expected string or bytes-like object
I can confirm that my proposed fix also works (wrapping e in str(e)): $ python3 -c "import DNS" /usr/lib/python3.6/site-packages/DNS/Base.py:100: DeprecationWarning: 'async' and 'await' will become reserved keywords in Python 3.7 self.async=None /usr/lib/python3.6/site-packages/DNS/Base.py:462: DeprecationWarning: invalid escape sequence \s res_re = re.compile('^\s+nameserver[]0-9[]*\s*\:\s*(\S+)$') /usr/lib/python3.6/site-packages/DNS/Base.py:56: UserWarning: [Errno 2] No such file or directory: '/etc/resolv.conf' warnings.warn(str(e))
I just realized I filed this against the wrong package.
python3-py3dns-3.1.1-3.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2018-298a67e758
python3-py3dns-3.1.1-5.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2018-25633cbab8
python3-py3dns-3.1.1-4.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2018-5be5753594
python3-py3dns-3.1.1-5.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-25633cbab8
python3-py3dns-3.1.1-3.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-298a67e758
python3-py3dns-3.1.1-4.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2018-5be5753594
python3-py3dns-3.1.1-5.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
python3-py3dns-3.1.1-3.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.
python3-py3dns-3.1.1-4.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.