mirror of
https://framagit.org/framasoft/mobilizon.git
synced 2024-12-22 07:52:43 +00:00
0c667b13ae
* CSV * PDF (requires Python dependency `weasyprint`) * ODS (requires Python dependency `pyexcel_ods3`) Signed-off-by: Thomas Citharel <tcit@tcit.fr>
28 lines
621 B
Elixir
28 lines
621 B
Elixir
defmodule Mobilizon.PythonPort do
|
|
@moduledoc """
|
|
Port to use Python modules from Elixir
|
|
"""
|
|
|
|
use Export.Python
|
|
|
|
@doc """
|
|
## Parameters
|
|
- path: directory to include in python path
|
|
"""
|
|
@spec python_instance(String.t()) :: pid
|
|
def python_instance(path) do
|
|
python = "/usr/bin/python3"
|
|
|
|
{:ok, pid} = Python.start(python: python, python_path: path)
|
|
|
|
pid
|
|
end
|
|
|
|
@doc """
|
|
Call python function using MFA format
|
|
"""
|
|
@spec call_python(pid, binary, binary, list) :: any
|
|
def call_python(pid, module, function, arguments \\ []) do
|
|
Python.call(pid, module, function, arguments)
|
|
end
|
|
end
|