diff --git a/lasio/examples.py b/lasio/examples.py index cdb9591..7cbfee7 100644 --- a/lasio/examples.py +++ b/lasio/examples.py @@ -78,8 +78,8 @@ def open_github_example( response = urllib.request.urlopen(url) if response.headers.get_content_charset() is None: - if "encoding" in encoding_kwargs: - encoding = encoding_kwargs["encoding"] + if "encoding" in kwargs: + encoding = kwargs["encoding"] else: encoding = "utf-8" else: diff --git a/lasio/excel.py b/lasio/excel.py index 449a3fa..b6d24b4 100644 --- a/lasio/excel.py +++ b/lasio/excel.py @@ -103,8 +103,8 @@ def main(): lasfn = args.LAS_filename xlsxfn = args.XLSX_filename - l = las.LASFile(lasfn) - converter = ExcelConverter(l) + las_obj = las.LASFile(lasfn) + converter = ExcelConverter(las_obj) converter.write(xlsxfn) @@ -132,10 +132,12 @@ def main_bulk(): xlsxfn = lasfn.lower().replace(".las", ".xlsx") print("Converting %s -> %s" % (lasfn, xlsxfn)) try: - l = las.LASFile(lasfn, ignore_header_errors=args.ignore_header_errors) - converter = ExcelConverter(l) + las_obj = las.LASFile(lasfn, ignore_header_errors=args.ignore_header_errors) + converter = ExcelConverter(las_obj) converter.write(xlsxfn) - except: + except Exception: + # https://www.flake8rules.com/rules/E722.html + # https://github.com/PyCQA/pycodestyle/issues/703 print( "Failed to convert file. Error message:\n" + traceback.format_exc() )