Set PYTHONPATH environment variable for Python script scrapers (#4372)

* Set PYTHONPATH environment variable for Python script scrapers
* Convert PYTHONPATH to absolute
* Generalise and apply to plugins

---------

Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
Maista
2023-12-20 03:32:19 +01:00
committed by GitHub
parent 8c922ed9e1
commit e8af3c8e98
3 changed files with 21 additions and 0 deletions

View File

@@ -7,6 +7,7 @@ import (
"fmt"
"io"
"os/exec"
"path/filepath"
"strings"
"sync"
@@ -52,6 +53,9 @@ func (t *rawPluginTask) Start() error {
logger.Warnf("%s", err)
} else {
cmd = p.Command(context.TODO(), command[1:])
envVariable, _ := filepath.Abs(filepath.Dir(filepath.Dir(t.plugin.path)))
python.AppendPythonPath(cmd, envVariable)
}
}