AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones Python
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Descarga la DLL de Python y libera la memoria.
Ejemplo
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> = PythonTerminate()
<Result>: Booleano
  • True si se liberó la memoria,
  • False en caso contrario.
Clasificación Lógica de negocio / UI: Código neutro
Componente: wd290vm.dll
Versión mínima requerida
  • Versión 27
Esta página también está disponible para…
Comentarios
IMPORTANTE
IF PythonInitialize("C:\Programs\Python\Python39\python39.dll") THEN
PythonAddPath("C:\tmp\python-modules\")
PythonExecute("test_module", "id", 5)
END
Boller
13 05 2024
IMPORTANTE
PARA FUNCIONAR NO WEBDEV

É necessário setar corretamente o caminho do modulo python, para executar uma função em um módulo python:

sPythonModule is string

<IF ExecutionTarget=Windows>

sPythonModule = SysDir(srLocalAppData) + ..
[fSep]+"Programs\Python\Python39\python39.dll"

END
Boller
13 05 2024

Última modificación: 22/06/2023

Señalar un error o enviar una sugerencia | Ayuda local