[Bug 2047453] Re: Error message missing compared to `apt-get update`
Julian Andres Klode
2047453 at bugs.launchpad.net
Wed Dec 27 08:15:32 UTC 2023
You'll have to investigate the individual items to see why it failed.
It's generally not advisable to use the "apt" module as it is badly
abstracted, use "apt_pkg" instead.
** Changed in: python-apt (Ubuntu)
Status: New => Invalid
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python-apt in Ubuntu.
https://bugs.launchpad.net/bugs/2047453
Title:
Error message missing compared to `apt-get update`
Status in python-apt package in Ubuntu:
Invalid
Bug description:
Assuming there is no package server running on `localhost`:
```
$ echo 'deb [trusted=yes] http://localhost:8000/ bogus-test-repo main' | sudo tee /etc/apt/sources.list.d/placeholder-test-repo.list
```
and then
```
$ python -c "import apt; c = apt.Cache(); c.update()"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python3/dist-packages/apt/cache.py", line 575, in update
raise FetchFailedException()
apt.cache.FetchFailedException
```
and compare with
```
$ sudo apt-get update
Ign:1 http://localhost:8000 bogus-test-repo InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease
Hit:4 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Ign:1 http://localhost:8000 bogus-test-repo InRelease
Ign:1 http://localhost:8000 bogus-test-repo InRelease
Err:1 http://localhost:8000 bogus-test-repo InRelease
Could not connect to localhost:8000 (127.0.0.1). - connect (111: Connection refused)
Reading package lists... Done
W: Failed to fetch http://localhost:8000/dists/bogus-test-repo/InRelease Could not connect to localhost:8000 (127.0.0.1). - connect (111: Connection refused)
W: Some index files failed to download. They have been ignored, or old ones used instead.
```
I expected the Python `apt` interface to produce a similar or
identical error message.
```
# lsb_release -rd
Description: Ubuntu 22.04.3 LTS
Release: 22.04
# apt-cache policy python3-apt
python3-apt:
Installed: 2.4.0ubuntu2
Candidate: 2.4.0ubuntu2
Version table:
*** 2.4.0ubuntu2 500
500 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
100 /var/lib/dpkg/status
2.3.0ubuntu2 500
500 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages
```
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python-apt/+bug/2047453/+subscriptions
More information about the foundations-bugs
mailing list