We do not print warnings on stderr in apt; the library logs them to the error handler, the python-apt code then translates them into Python warnings used in the warnings module using apt_pkg.Warning instances. Unless there is an error, in which case warnings are merged into the exception as context.
Consumers of apt_pkg can filter out apt_pkg.Warning warnings the usual way using the warnings module, including but not limited to: with warnings.catch_warnings(category=apt_pkg.Warning): do something The warnings addition is a new feature to ensure warnings don't get lost, previously warnings were only part of exceptions. A future version of APT may add error ids to the error logging framework, which then could be translated into apt_pkg.Error and apt_pkg.Warning subclasses. ** Changed in: apt (Ubuntu) Status: New => Invalid -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2064624 Title: Warning: W:Unable to read /var/lib/ubuntu-advantage/apt- esm/etc/apt/apt.conf.d/ - DirectoryExists (2: No such file or directory) To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apt/+bug/2064624/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs