|
|
|
|
PythonInitialize (Función) Indica la ubicación de la DLL de Python a cargar. sPythonModule is string <IF ExecutionTarget=Windows> // Example of a Python module location // The name of the Python module can be different sPythonModule = SysDir(srLocalAppData) + .. [fSep]+"Programs\Python\Python39\python39.dll" <ELSE> <IF ExecutionTarget=Linux> // Example of a Python module location // The name of the Python module can be different // (depends on the version of Python, the Linux distribution) sPythonModule ="/usr/bin/python/python39.so" <END> <END> IF NOT PythonInitialize(sPythonModule) THEN // In this case, you must: // Check the path // Check that the compilation mode (32/64-bit) matches the runtime mode Error("Python initialization error", ErrorInfo()) RETURN END Info(HelloWorldImportedPythonFunction()) // With an imported Python file (.py) in the project that contains: // def HelloWorldImportedPythonFunction(): // return "Hello World!"; IF NOT PythonAddPath(fDataDir()) THEN Error("Unable to initialize Python path", ErrorInfo()) RETURN END // "python_file.py" must be in the directory // specified by PythonAddPath. // In this example, this directory is the data directory Info(PythonExecute("python_file", "HelloWorldPythonFunctionNotImported")) PythonTerminate() Sintaxis
<Result> = PythonInitialize(<DLL location>)
<Result>: Booleano - True si la carga se realizó correctamente,
- False en caso contrario.
<DLL location>: Cadena de caracteres Ruta completa o relativa de la DLL de Python a cargar. Observaciones - La DLL de Python debe tener la misma arquitectura que la aplicación. Por ejemplo, si la aplicación se ejecuta en modo de 32 bits, debe utilizarse una DLL de 32 bits.
- La versión de la DLL es importante: La ABI de Python puede cambiar de una versión de Python a otra (consulte la documentación de Python). Se debe utilizar una interfaz de Python compatible con Python 3.9.
- Gestión de errores:
Si hay un problema durante la carga, se produce un error fatal: versión no soportada, error interno de Python, etc.
Clasificación Lógica de negocio / UI: Código neutro
Esta página también está disponible para…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|