Fix windows specific issues

Benoit Seignovert requested to merge fix-windows-issues into main

Closes #80 (closed) and #81 (closed)


  • Support ~ path for kernels and metakernels inputs and substitutions in TourConfig/MetaKernel/SpicePool:
MetaKernel('~/Desktop/', kernels='~/Documents')
TourConfig(mk='~/Desktop/', kernels_dir='~/Documents')

This is supported for Windows, Linux and macOS and will be internally replaced by C:\Users\<USERNAME>, /home/<USERNAME> and /Users/<USERNAME> respectively.


  • By default on windows, the number of download threads is now set to 1 to disable multi-thread downloads (#80 (closed)). This avoid to raise RuntimeError on freeze_support() when a python script is executed.

If you use Jupyter notebooks, you can by-pass this default and provide a n_threads keyword explicitly:

MetaKernel('', download=True, n_threads=2)

If you need to execute it in a script (ie. python.exe in this case, you need to encapsulate the call:

if __name__ == "__main__": 
    MetaKernel('', download=True, n_threads=2)
  • MetaKernelnow escape correctly Windows path strings (#81 (closed)):
TourConfig(mk='', kernel_dir='C:/Users/foo')
TourConfig(mk='', kernel_dir=r'C:\Users\foo')
TourConfig(mk='', kernel_dir='C:\\Users\\foo')

The path is provided with \ it should be either a regex-string or properly escaped with \\

trailing \ in r-string is not supported in python. Use \\ instead.

Edited by Benoit Seignovert

Merge request reports