Skip to content

Commit

Permalink
Executable only makes sense for scripts
Browse files Browse the repository at this point in the history
Closes #325
  • Loading branch information
mwouts committed Sep 17, 2019
1 parent a8ad51f commit 5c3f5c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jupytext/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 5c3f5c4

Please sign in to comment.