Source, documentation, and distribution code for un-xtab.py
修訂 | 6baeae66ed1d54aabe82e10bca80154db83d2dbc (tree) |
---|---|
時間 | 2022-02-02 11:09:21 |
作者 | rdnielsen |
Commiter | rdnielsen |
Revisions for backwards-incompatible Python changes.
@@ -58,7 +58,8 @@ | ||
58 | 58 | # 2019-09-11 Modified to allow column IDs for the "data_columns" setting to be |
59 | 59 | # letters as well as numbers. RDN. |
60 | 60 | # 2021-08-16 Modified to seek(0) in the output buffer before truncating it. RDN. |
61 | -# 2022-02-01 Modified to use argparse instead of optparse. RDN. | |
61 | +# 2022-02-01 Corrected setting of error_type. Modified to use argparse instead of optparse. | |
62 | +# Replaced "string.letters", which no longer exists. RDN. | |
62 | 63 | #===================================================================================== |
63 | 64 | |
64 | 65 |
@@ -160,6 +161,8 @@ | ||
160 | 161 | self.program_name=program_name |
161 | 162 | if error_type is not None: |
162 | 163 | self.error_type=error_type.__name__ |
164 | + else: | |
165 | + self.error_type = '(unknown)' | |
163 | 166 | self.error_value=error_value, |
164 | 167 | self.source_lno=source_lno |
165 | 168 | self.source_txt=source_txt |
@@ -433,7 +436,8 @@ | ||
433 | 436 | def letters_to_decimal(col_id): |
434 | 437 | """Converts a spreadsheet column ID, consisting of one or more letters, |
435 | 438 | into the decimal equivalent.""" |
436 | - ltrs = string.letters[:26] | |
439 | + #ltrs = string.letters[:26] | |
440 | + ltrs = 'abcdefghijklmnopqrstuvwxyz' | |
437 | 441 | val = 0 |
438 | 442 | for c in col_id.lower(): |
439 | 443 | val = val * 26 + ltrs.index(c) + 1 |
@@ -773,9 +777,6 @@ | ||
773 | 777 | if opts.showspecs: |
774 | 778 | print(CONFIG_KEYWORDS) |
775 | 779 | return 0 |
776 | - if len(opts) == 0: | |
777 | - parser.print_help() | |
778 | - return 0 | |
779 | 780 | common["printconfig"] = opts.printconfig |
780 | 781 | common["printheaders"] = opts.printheaders |
781 | 782 | # Check for two filename arguments, the first of which is an existing file. |