nerdexam
Cisco

300-910 · Question #2

Refer to the exhibit. What is the reason for this error message? Traceback (most recent call last): File "api-call.py", line 1, in <module> import requests File "/usr/devnet/vsnv/devops/lib/python3.7/

The correct answer is C. The required dependencies for the requests module are not installed.. The traceback indicates a ModuleNotFoundError for urllib3 when requests is trying to import it, meaning urllib3 is a missing dependency for the requests module.

Software Development and Design

Question

Refer to the exhibit. What is the reason for this error message? Traceback (most recent call last): File "api-call.py", line 1, in <module> import requests File "/usr/devnet/vsnv/devops/lib/python3.7/site-packages/requests/init.py", line 43, in <module> import urllib3 ModuleNotFoundError: No module named 'urllib3'

Exhibit

300-910 question #2 exhibit

Options

  • AThe required dependencies for the urllib3 module are not installed.
  • BThe requests module is not installed.
  • CThe required dependencies for the requests module are not installed.
  • DThe site-packages directory has been corrupted.

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    94% (29)

Why each option

The traceback indicates a `ModuleNotFoundError` for `urllib3` when `requests` is trying to import it, meaning `urllib3` is a missing dependency for the `requests` module.

AThe required dependencies for the urllib3 module are not installed.

The error message specifically states 'No module named 'urllib3'', not that `urllib3` is installed but its own dependencies are missing.

BThe requests module is not installed.

The `import requests` line at the beginning of the traceback indicates that the `requests` module *is* found and is attempting to load, so it is installed.

CThe required dependencies for the requests module are not installed.Correct

The traceback indicates that the `requests` module itself is being imported successfully, but then encounters `ModuleNotFoundError: No module named 'urllib3'` when attempting to import `urllib3` internally. This means that `urllib3` is a required dependency for `requests` to function correctly, and it is not installed or accessible in the Python environment.

DThe site-packages directory has been corrupted.

While a corrupted `site-packages` directory could lead to module import errors, the specific `ModuleNotFoundError` for a particular module suggests a targeted missing dependency rather than general corruption.

Concept tested: Python dependency management and error interpretation

Source: https://docs.python.org/3/library/exceptions.html#ModuleNotFoundError

Topics

#Python dependencies#ModuleNotFoundError#requests library#Traceback interpretation

Community Discussion

No community discussion yet for this question.

Full 300-910 Practice