# HG changeset patch # User Henry S. Thompson # Date 1781209001 -3600 # Node ID c7c72311b73100adc1e56dcdf419d813a7f40af0 # Parent 10dfd4feeaa08ccc95471fe08874ea6d40f84591 fix big comment, get callback working diff -r 10dfd4feeaa0 -r c7c72311b731 bin/cdx2tsv.py --- a/bin/cdx2tsv.py Thu Jun 11 21:15:35 2026 +0100 +++ b/bin/cdx2tsv.py Thu Jun 11 21:16:41 2026 +0100 @@ -11,8 +11,10 @@ Note that 'key' and 'timestamp' are also available as global variables, so e.g. '(key,key.split(",")[0])' will yield the TLD. - For a callback instead of printing, include -c cb-mod for a module to import + For a callback instead of printing, include -c cb-mod.cb-file for + a file from a module to import and within which to call init() once and the cbf function for each index line + and finally finish() ''' import json,sys @@ -23,9 +25,9 @@ index=str(int(sys.argv.pop(1))) elif sys.argv[1] == '-c': sys.argv.pop(1) - cbmodname = sys.argv.pop(1) - from importlib import import_module - cbm = import_module(cbmodname) + (cbmodname,cbfilename) = sys.argv.pop(1).split('.') + import importlib + cbm = importlib.import_module(cbfilename,cbmodname) cbf=cbm.cbf cbm.init() else: