turn off multiprocessing if debug

This commit is contained in:
Robert Kubosz
2020-05-13 14:24:20 +02:00
parent 6a5878da93
commit da82f37421
+7 -4
View File
@@ -438,7 +438,7 @@ def _make_pdf_pdftk(fields, src_pdf, basename, flatten=False):
def make_sheet(character_file, character=None, flatten=False, fancy_decorations=False, debug=False): def make_sheet(character_file, character=None, flatten=False, fancy_decorations=False, debug=False):
"""Prepare a PDF character sheet from the given character file. """Prepare a PDF character sheet from the given character file.
Parameters Parameters
---------- ----------
character_file : str character_file : str
@@ -583,9 +583,12 @@ def main():
filenames = [f for f in os.listdir('.') if os.path.splitext(f)[1] == '.py'] filenames = [f for f in os.listdir('.') if os.path.splitext(f)[1] == '.py']
else: else:
filenames = [args.filename] filenames = [args.filename]
if args.debug:
with Pool(cpu_count()) as p: for filename in filenames:
p.starmap(_build, product(filenames, [args])) _build(filename, args)
else:
with Pool(cpu_count()) as p:
p.starmap(_build, product(filenames, [args]))
if __name__ == '__main__': if __name__ == '__main__':