davidfoerster / aptsources-cleanup

Detects and interactively deactivates duplicate Apt source entries and deletes sources list files without valid enabled source entries (as requested in https://askubuntu.com/a/762815/175814).
MIT License
667 stars 85 forks source link

Division by zero error #5

Closed alexbowers closed 6 years ago

alexbowers commented 6 years ago
File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
==> default:     "__main__", mod_spec)
==> default:   File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
==> default:     exec(code, run_globals)
==> default:   File "/tmp/aptsources-cleanup.zip/__main__.py", line 9, in <module>
==> default:   File "/usr/lib/python3.5/runpy.py", line 199, in run_module
==> default:     return _run_code(code, {}, init_globals, run_name, mod_spec)
==> default:   File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
==> default:     exec(code, run_globals)
==> default:   File "/tmp/aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 362, in <module>
==> default:   File "/tmp/aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 48, in main
==> default:   File "/tmp/aptsources-cleanup.zip/aptsources_cleanup/__main__.py", line 330, in handle_empty_files
==> default:   File "/tmp/aptsources-cleanup.zip/aptsources_cleanup/util/gettext.py", line 468, in ask
==> default:
==> default:   File "/tmp/aptsources-cleanup.zip/aptsources_cleanup/util/gettext.py", line 424, in print_question
==> default:     def translation(domain, localedir=None, languages=None,
==> default: ZeroDivisionError: integer division or modulo by zero
==> default: Overlapping source entries:
==> default:  1. file '/etc/apt/sources.list':
==> default: deb https://apt.dockerproject.org/repo/ ubuntu-xenial main
==> default:
==> default:  2. file '/etc/apt/sources.list.d/docker.list':
==> default: deb https://apt.dockerproject.org/repo ubuntu-xenial main
==> default:
==> default: I disabled the latter entry.
==> default:
==> default: 1 source entry was disabled:
==> default: # deb https://apt.dockerproject.org/repo ubuntu-xenial main
==> default:
==> default: '/etc/apt/sources.list.d/docker.list' contains no valid and enabled repository lines.
==> default: Do you want to remove it?

Running inside of vagrant (hence the default: prefix).

alexbowers commented 6 years ago

My script is as follows:

wget https://github.com/davidfoerster/aptsources-cleanup/releases/download/v0.1.2/aptsources-cleanup.zip -O /tmp/aptsources-cleanup.zip
python3 -OEs /tmp/aptsources-cleanup.zip --yes
rm /tmp/aptsources-cleanup.zip
davidfoerster commented 6 years ago

Thanks again for the report! Looks like I failed to add a check for the absence of a terminal device. Like I said: it's meant mainly as an interactive application and that's how I test it.

I'll get right to it since the fix should be trivial.

davidfoerster commented 6 years ago

Fixed in commit 4d237fe99e9a96d7a135cf5e39aa32c9b5c7f668.

alexbowers commented 6 years ago

Thanks for the prompt responses and fix :D