diff options
Diffstat (limited to 'qutebrowser/components/misccommands.py')
-rw-r--r-- | qutebrowser/components/misccommands.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/qutebrowser/components/misccommands.py b/qutebrowser/components/misccommands.py index 0b3a918d1..5bbf93e6a 100644 --- a/qutebrowser/components/misccommands.py +++ b/qutebrowser/components/misccommands.py @@ -96,8 +96,12 @@ def _print_pdf(tab: apitypes.Tab, filename: str) -> None: tab.printing.check_pdf_support() filename = os.path.expanduser(filename) directory = os.path.dirname(filename) - if directory and not os.path.exists(directory): - os.mkdir(directory) + + try: + os.makedirs(directory, exist_ok=True) + except OSError as e: + raise cmdutils.CommandError(e) + tab.printing.to_pdf(filename) _LOGGER.debug("Print to file: {}".format(filename)) |