cellid_import: fix TypeError when --mcc or --mnc are unspecified
`int(None)` (in the case these arguments are unspecified) gives a TypeError. ``` $ cellid-ols-import -o cell_towers.db cell_towers.csv [2024-06-21 13:34:48.169] DEBUG: Database version: 1 Traceback (most recent call last): File "cellid-ols-import", line 9, in <module> sys.exit(main()) ^^^^^^ File "ols/resolver/cellid/cellid_import.py", line 43, in main mcc = int_or_none(args.MCC) ^^^^^^^^^^^^^^^^^^^^^ File "ols/resolver/cellid/cellid_import.py", line 18, in int_or_none return int(s) ^^^^^^ TypeError: int() argument must be a string, a bytes-like object or a real number, not 'NoneType' ```
This commit is contained in:
@@ -16,7 +16,7 @@ log = logging.getLogger(__name__)
|
||||
def int_or_none(s):
|
||||
try:
|
||||
return int(s)
|
||||
except ValueError:
|
||||
except (TypeError, ValueError):
|
||||
return None
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user