kynan / nbstripout

strip output from Jupyter and IPython notebooks
Other
1.19k stars 95 forks source link

nbstripout fails if git is not on PATH #124

Closed takluyver closed 4 years ago

takluyver commented 4 years ago

This is educated guesswork based on this comment. I'll paste the traceback below.

These lines in main() try to get some git config, with a fallback if the command fails:

https://github.com/kynan/nbstripout/blob/dcbb009d03121b2f5a6fba8336122e6b6d9d9f81/nbstripout/_nbstripout.py#L288-L291

But when the command is not available, subprocess raises FileNotFoundError rather than CalledProcessError, which doesn't get caught. I'm guessing it should simply catch both and use the same fallback in either case, as it doesn't look like nbstripout is meant to rely on git.


Traceback from @pragati0416:

Traceback (most recent call last):
  File "c:\programdata\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\ProgramData\Anaconda3\Scripts\nbstripout.exe\__main__.py", line 9, in <module>
  File "c:\programdata\anaconda3\lib\site-packages\nbstripout\_nbstripout.py", line 281, in main
    extra_keys = check_output(git_config + ['filter.nbstripout.extrakeys']).strip()
  File "c:\programdata\anaconda3\lib\subprocess.py", line 395, in check_output
    **kwargs).stdout
  File "c:\programdata\anaconda3\lib\subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:
  File "c:\programdata\anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "c:\programdata\anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified