Skip to content

Commit 39e4f54

Browse files
committedApr 23, 2022
Restore logic from previous merge
1 parent 3e67a46 commit 39e4f54

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed
 

‎ttable.py

+21-16
Original file line numberDiff line numberDiff line change
@@ -235,22 +235,27 @@ def main():
235235
if output_filename is None or output_filename == '-':
236236
output_file = sys.stdout
237237
else:
238-
with open(output_filename, 'w') as output_file:
239-
try:
240-
library = ToolLibrary(input_filename)
241-
except IOError as e:
242-
sys.stderr.write("%s\n" % e)
243-
sys.exit(-1)
244-
245-
if arguments['--metric']:
246-
library.set_machine_units(ToolLibrary.METRIC_UNITS)
247-
elif arguments['--imperial']:
248-
library.set_machine_units(ToolLibrary.IMPERIAL_UNITS)
249-
250-
library.show(Tool.TYPE_ALL)
251-
library.hide(Tool.TYPE_HOLDERS)
252-
253-
print_linuxcnc_tool_table(output_file, library)
238+
try:
239+
output_file = open(output_filename, 'w')
240+
except IOError as e:
241+
sys.stderr.write("%s\n" % e)
242+
sys.exit(-1)
243+
244+
try:
245+
library = ToolLibrary(input_filename)
246+
except IOError as e:
247+
sys.stderr.write("%s\n" % e)
248+
sys.exit(-1)
249+
250+
if arguments['--metric']:
251+
library.set_machine_units(ToolLibrary.METRIC_UNITS)
252+
elif arguments['--imperial']:
253+
library.set_machine_units(ToolLibrary.IMPERIAL_UNITS)
254+
255+
library.show(Tool.TYPE_ALL)
256+
library.hide(Tool.TYPE_HOLDERS)
257+
258+
print_linuxcnc_tool_table(output_file, library)
254259

255260

256261
if __name__ == "__main__":

0 commit comments

Comments
 (0)
Please sign in to comment.