Python3Script Xojo Plugin

Python3Script Class

A class that encapsulates the Python 3 script engine. You should not create instance of this class. Its a singleton class and all its functions are static and can be called without instance.

Always do if check on Python3Script.PythonIsFound to see if Python is installed before using any method in this class.


class Python3Script


shared AddSearchPathAdds search path for where Python will load custom modules from.
shared ClearErrorClears the error indicator, making ErrorOccurred return false again.
shared ErrorOccurredReturns true if error has occurred, else false.
shared FinalizeCall this method to clean up resources that the Python engine used. Your application should normally call this when it shuts down if it has used Python.
shared GetErrorGets the error message if the ErrorOccurred property indicates there was a error.
shared GetModuleGets a python module, looking for it at Pythons default path and custom paths.
shared InitCall this method to initialise the Python engine for your application. This variation takes application name as parameter.
shared InitCall this method to initialise the Python engine for your application. This variation takes no parameter.
shared PythonIsFoundChecks if valid Python installation is found. Optionally a constant can also be passed in to hint which version of Python is preferred if Python has not already been loaded.
shared RegisterXojoModuleRegisters a Xojo module to expose to python.
shared SetConsoleOutputUse this method to register a redirect of console output from Python scripts.
shared SetErrorUse this method to raise a error.
shared SetPythonPathSets alternate path where to look for Python.


PreferredVersionValuesEnum which can optionaly be used in the Python3Script.PythonIsFound shared function.



Important installation information:

Note that on Windows systems to be able to test both 32 bit and 64 bit on same machine then I had to first install 64 bit Python from the python-3.4.3.amd64.msi, and then python-3.4.3.msi, selecting other path for the 2nd one and unchecking register extensions. I tried first to do it the other way, 32 bit first and then 64 bit but could not get that to work, maybe it is possible though.

Supported Platforms:

  • MacOS X Cocoa 32 bit
  • MacOS X Cocoa 64 bit
  • Windows 32 bit
  • Windows 64 bit
  • Linux 32 bit
  • Linux 64 bit
  • Linux ARM