Skip to content

Fix windows specific issues

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

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

Add

  • Support ~ path for kernels and metakernels inputs and substitutions in TourConfig/MetaKernel/SpicePool:
SpicePool.add('~/Desktop/naif0012.tls')
MetaKernel('~/Desktop/mk.tm', kernels='~/Documents')
TourConfig(mk='~/Desktop/mk.tm', 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.

Fixes

  • 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('metakernel.tm', download=True, n_threads=2)

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

if __name__ == "__main__": 
    MetaKernel('metakernel.tm', download=True, n_threads=2)
  • MetaKernelnow escape correctly Windows path strings (#81 (closed)):
TourConfig(mk='metakernel.tm', kernel_dir='C:/Users/foo')
TourConfig(mk='metakernel.tm', kernel_dir=r'C:\Users\foo')
TourConfig(mk='metakernel.tm', 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