partsdb

electronic parts inventory
git clone https://git.e1e0.net/partsdb.git
Log | Files | Refs | README | LICENSE

commit 42b11b89a1caf17fd412afb657f3244ef9e5cc22
parent 5f65f13d56b474e6253df8f7c357a35b6afbed5c
Author: Paco Esteban <paco@e1e0.net>
Date:   Tue, 10 Oct 2023 18:04:08 +0200

do not crash when there is no part to get

Diffstat:
Mpartsdb/partsdb.py | 5+++++
1 file changed, 5 insertions(+), 0 deletions(-)

diff --git a/partsdb/partsdb.py b/partsdb/partsdb.py @@ -149,6 +149,11 @@ def search_part(search_term, output): def get_part(part_id, output): part = db.get_part(part_id) history = db.get_part_history(part_id) + + if not part: + print("No part with that ID or PN") + return + helpers.print_part(part, history, output)