Pebaz / nimporter

Compile Nim Extensions for Python On Import!
MIT License
821 stars 33 forks source link

Quality Of Life - Better error message for when Nim/Nimble is not installed or can't be found #71

Open Pebaz opened 2 years ago

Pebaz commented 2 years ago

Add better error messages for the 2.0.0rc branch.

ImportError: Failed to import test module: faster_than_requests
Traceback (most recent call last):
  File "D:\soft\py39\lib\unittest\loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "D:\soft\py39\lib\unittest\loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "D:\code\me\faster-than-requests\faster_than_requests\__init__.py", line 7, in <module>
    from . faster_than_requests import *
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1002, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 945, in _find_spec
  File "D:\soft\py39\lib\site-packages\nimporter\nimporter.py", line 253, in <lambda>
    lambda fullname, path, _: nimport(fullname, path, library=False)
  File "D:\soft\py39\lib\site-packages\nimporter\nimporter.py", line 217, in nimport
    compile_extension_to_lib(ext)
  File "D:\soft\py39\lib\site-packages\nimporter\nimporter.py", line 62, in compile_extension_to_lib
    ensure_nimpy()
  File "D:\soft\py39\lib\site-packages\nimporter\lib.py", line 213, in ensure_nimpy
    code, *_ = run_process(shlex.split('nimble path nimpy'), show_output)
  File "D:\soft\py39\lib\site-packages\nimporter\lib.py", line 155, in run_process
    process = subprocess.run(
  File "D:\soft\py39\lib\subprocess.py", line 501, in run
    with Popen(*popenargs, **kwargs) as process:
  File "D:\soft\py39\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "D:\soft\py39\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified