Skip to content

Commit

Permalink
Handle SIGPIPE and SIGINT with default handler
Browse files Browse the repository at this point in the history
  • Loading branch information
OMOTO Kenji committed May 26, 2015
1 parent aa1311b commit 75c2c92
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion xlsx2csv.py
Expand Up @@ -23,7 +23,7 @@
__license__ = "GPL-2+"
__version__ = "0.7.2"

import csv, datetime, zipfile, string, sys, os, re
import csv, datetime, zipfile, string, sys, os, re, signal
import xml.parsers.expat
from xml.dom import minidom
try:
Expand Down Expand Up @@ -775,6 +775,9 @@ def convert_recursive(path, sheetid, outfile, kwargs):
print("File %s is not a zip file" %fullpath)

if __name__ == "__main__":
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
signal.signal(signal.SIGINT, signal.SIG_DFL)

if "ArgumentParser" in globals():
parser = ArgumentParser(description = "xlsx to csv converter")
parser.add_argument('infile', metavar='xlsxfile', help="xlsx file path")
Expand Down Expand Up @@ -867,3 +870,4 @@ def convert_recursive(path, sheetid, outfile, kwargs):
raise XlsxException("Sheet '%s' not found" % options.sheetname)

xlsx2csv.convert(outfile, sheetid)

0 comments on commit 75c2c92

Please sign in to comment.