From 5c3f5c4623f7d3565693080b942b6b2cbedf90c7 Mon Sep 17 00:00:00 2001 From: Marc Wouts Date: Sun, 15 Sep 2019 20:15:22 +0200 Subject: [PATCH] Executable only makes sense for scripts Closes #325 --- jupytext/header.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jupytext/header.py b/jupytext/header.py index 22994230b..47ae5af8a 100644 --- a/jupytext/header.py +++ b/jupytext/header.py @@ -54,12 +54,12 @@ def encoding_and_executable(notebook, metadata, ext): comment = _SCRIPT_EXTENSIONS.get(ext, {}).get('comment') jupytext_metadata = metadata.get('jupytext', {}) - if ext not in ['.Rmd', '.md'] and 'executable' in jupytext_metadata: + if comment is not None and 'executable' in jupytext_metadata: lines.append(comment + '!' + jupytext_metadata.pop('executable')) if 'encoding' in jupytext_metadata: lines.append(jupytext_metadata.pop('encoding')) - elif ext not in ['.Rmd', '.md']: + elif comment is not None: for cell in notebook.cells: try: cell.source.encode('ascii')