Question

I have Python 2.7 installed in "C:\Python27". Now I run 1st demo of Python4delphi with D7, which somehow uses my Py2.7 install folder. If I rename Python folder, demo can't run (without error message). I didn't change properties of a demo form.

What part/file does py4delphi use from my Python folder?

Was it helpful?

Solution

python4delphi is a loose wrapper around the Python API and as such relies on a functioning Python installation. Typically on Windows this comprises at least the following:

  • The main Python directory. On your system this is C:\Python27.
  • The Python DLL which is python27.dll and lives in your system directory.
  • Registry settings that indicate where your Python directory is installed.

When you rename the Python directory, the registry settings refer to a location that no longer exists. And so the failure you observe is entirely to be expected.


Perhaps you are trying to work out how to deploy your application in a self-contained way without requiring an external dependency on a Python installation. If so, then I suggest you look in to one of the portable Python distributions. You may need to adapt python4delphi a little to find the Python DLL which will be located under your application's directory. But that should be all that's needed. Take care of the licensing issues too if you do distribute Python with your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top