{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "\n\n# Avoiding the automatic download of SpatiaLite binaries on Windows\n\nIn this example, we show how to prevent Windows from downloading the SpatiaLite binaries automatically.\n\nThis may be relevant to users in corporate environments where the download and use of binaries to\nthe Windows temporary is restricted.\n\nSpatialite Logo by Massimo Zedda, image from https://www.gaia-gis.it/\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "# Imports\nimport os\nfrom os.path import join\nfrom tempfile import gettempdir\nfrom uuid import uuid4\n\nfrom aequilibrae.utils.create_example import create_example"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "from aequilibrae.utils.spatialite_utils import set_known_spatialite_folder, ensure_spatialite_binaries\n\n# First we prevent Windows from downloading spatialite binaries during this session\n# THIS VALUE MUST BE UPPER CASE TO BE EFFECTIVE\nos.environ[\"AEQ_SPATIALITE_DIR\"] = r\"C:\\path\\to\\existing\\download\""
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "Now we can go about our business as usual\n\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "collapsed": false
      },
      "outputs": [],
      "source": [
        "project = create_example(join(gettempdir(), uuid4().hex))\nproject.close()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "codemirror_mode": {
        "name": "ipython",
        "version": 3
      },
      "file_extension": ".py",
      "mimetype": "text/x-python",
      "name": "python",
      "nbconvert_exporter": "python",
      "pygments_lexer": "ipython3",
      "version": "3.10.18"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}