kynan / nbstripout

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

Global installation failing on Windows (KeyError: 'HOME') #136

Closed ubalklen closed 3 years ago

ubalklen commented 3 years ago
> nbstripout --install --global

Traceback (most recent call last):
  File "C:\Users\username\Miniconda3\envs\ds\Scripts\nbstripout-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\username\Miniconda3\envs\ds\lib\site-packages\nbstripout\_nbstripout.py", line 299, in main
    sys.exit(install(git_config, user=args._global, attrfile=args.attributes))
  File "C:\Users\username\Miniconda3\envs\ds\lib\site-packages\nbstripout\_nbstripout.py", line 156, in install
    attrfile = _get_attrfile(git_config, user, attrfile)
  File "C:\Users\username\Miniconda3\envs\ds\lib\site-packages\nbstripout\_nbstripout.py", line 141, in _get_attrfile
    config_dir = environ.get('XDG_CONFIG_DIR', path.join(environ['HOME'], '.config'))
  File "C:\Users\username\Miniconda3\envs\ds\lib\os.py", line 681, in __getitem__
    raise KeyError(key) from None
KeyError: 'HOME'`

Apparently, HOME is not a Windows environment variable.

Single repo installation works fine.

kynan commented 3 years ago

I've pushed a fix, however I don't have a Windows system I can test it with. Could you please try with nbstripout from Git master (e.g. pip install https://github.com/kynan/nbstripout)?

I'm not entirely sure Git on Windows will actually read ~/.config/git/attributes. If you could test and verify that would be great!

kynan commented 3 years ago

I'll mark this fixed. Please reopen if you're still seeing the issue.