Skip to content

Running the Scripts

Brendan Coates edited this page Jul 31, 2024 · 8 revisions

This page gives an overview about running the scripts, generally.

Installation

If you haven't already, please review the Installation section of the README to ensure you have the various python libraires installed.

Navigate to Scripts Directory

This page assumes you are running the scripts directly from their directory, rather than adding the project to your PATH environment variable.

The top-level directory of this repo contains various administrative files necessary for modern Python code, it does not contain any actual scripts, those are located in the avmpi_scripts subdirectory.

If you followed the installation guide, you'll find this located at: /home/your_username/code/avmpi_scripts/avmpi_scripts

The Virtual Environment

This project has been separated from your machine's main Python environment, where conflicting package versioning can interrupt system services. In order to run these scripts, we must use the venv package.

Initialize the Virtual Environment

Please check that you have initialized the virtual environment by checking for a venv folder in the top level directory of this repo. For more info, see the installation guide.

Start the Virtual Environment

from the top-level directory of this repo, on Mac:

source venv/bin/activate

or, from the scripts subdirectory, on Mac

source ../venv/bin/activate

Invoking the Scripts

To actually run these, we need to precede the script name with python3. This is just how I do things at the moment, but it also guarantees that the correct version of Python (from your venv) is what executes the script. And it means you don't have to set each script as executable in the file registry.

Global options for scripts

Help

To get the overview of options for any script, use the -h or --help flag, e.g. python3 excel2airtable.py -h

Logging

Each script contains a logger which can give more or less information to the terminal screen.

If you use both -q and -v together, verbose mode will win

Quiet Mode

To print less info, only warnings and errors, use -q or --quiet

Verbose Mode

To print more info, like, so much more info, use -v or --verbose

Input

to define the input file(s) for a particular script, use -i or --input

Note that for input paths with spaces, you'll need to either escape them (with \) or enclose the file path in single or double quotes. My recommended method is drag-and-drop the file from your file browser into the terminal and let it figure it out.