Skip to content

Troubleshooting

Common errors and solutions when running data import scripts.

No module named 'requests'

Error message:

bash
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/vedran/projects/data-pipelines/dataimport-scripts/importers/emissions/generic.py", line 4, in <module>
    from helpers.utils import (
  File "/home/vedran/projects/data-pipelines/dataimport-scripts/helpers/utils.py", line 3, in <module>
    from .client import create_data_import, upload_file, start_import
  File "/home/vedran/projects/data-pipelines/dataimport-scripts/helpers/client.py", line 3, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Solution:

Make sure to install the requests library via pip:

bash
pip install requests

401 Client Error: Unauthorized for url

Description:

The API key argument is missing or is invalid for the selected environment.

Environment is passed as --environment script parameter and is one of: local, dev, prod-testing, or prod

If environment flag is not passed, the parameter defaults to local

Check the URL that the script is trying to access:

Solution:

Check the API key for the selected environment in the data import admin view within the platform or add --api_key argument if missing.

FileNotFoundError: [Errno 2] No such file or directory

Description:

The data_path parameter passed via --data_path is invalid.

Solution:

Double check the existence of your data import directory. Make sure you're providing the full, absolute path to the folder containing your data files.