Skip to content

Commit 794d9bf

Browse files
committed
Make the error message when trying to export an empty drawing more helpful.
Previously it was just sweep silently crashing when it couldn't find its input file.
1 parent 267e176 commit 794d9bf

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

inkscape/cookie-cutter-sweeper/export.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
binstderr.write(output)
5959
shutil.rmtree(tempdir, ignore_errors=True)
6060
sys.exit(process.returncode)
61+
if not os.path.exists(os.path.join(tempdir, 'cookie.png')):
62+
sys.stderr.write('Cannot export an empty drawing. Add some black shapes.')
63+
shutil.rmtree(tempdir, ignore_errors=True)
64+
sys.exit(1)
6165

6266
process = subprocess.Popen([os.path.join(os.getcwd(), bindir, 'sweep'), '--flip-x', os.path.join(os.getcwd(), 'section.png'), os.path.join(tempdir, 'cookie.png'), os.path.expanduser(options.outputfile)], stderr=subprocess.PIPE)
6367
output = process.communicate()[1]

0 commit comments

Comments
 (0)