0

I recently installed the python package faster_than_requests ver 21.3.3 from pypi on python ver 3.9.2 on windows. Upon importing the package as mentioned in the docs, I get the following traceback

>>> import faster_than_requests         
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\OS\Windows\Python-3.9\lib\site-packages\faster_than_requests\__init__.py", line 7, in <module>
    from . faster_than_requests import *
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 982, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 925, in _find_spec
  File "D:\OS\Windows\Python-3.9\lib\site-packages\nimporter.py", line 1150, in find_spec
    return Nimporter.import_nim_code(fullname, path, library=False)
  File "D:\OS\Windows\Python-3.9\lib\site-packages\nimporter.py", line 828, in import_nim_code
    NimCompiler.compile_nim_code(
  File "D:\OS\Windows\Python-3.9\lib\site-packages\nimporter.py", line 588, in compile_nim_code
    raise NimCompileException(errors[0])
  File "D:\OS\Windows\Python-3.9\lib\site-packages\nimporter.py", line 48, in __init__
    nim_module = nim_module.splitlines()[-1]
IndexError: list index out of range

Can someone please help me fix this?

  • maybe https://github.com/juancarlospaco/faster-than-requests#windows can help, shows some alternative windows installation methods – shirleyquirk May 07 '21 at 10:16

1 Answers1

2

This is caused in nimporter NimCompileException class. That means that the compilation failed, and while trying to show you the compilation error, it failed again.

Replace line 48 at D:\OS\Windows\Python-3.9\lib\site-packages\nimporter.py as follows:

48 nim_module = nim_module.splitlines()[-1]  # Original

48 try:                                      # New
49    nim_module = nim_module.splitlines()[-1]
50 except IndexError:
51    self.message = msg
52    return

Then run again >>> import faster_than_requests to get more info about the compilation failure.

xbello
  • 7,223
  • 3
  • 28
  • 41