Delphi and Python communication via Named Pipe in Windows

0

I hate questions with long text, but I could not get away from it.

I'm creating an application in Delphi XE5 that needs to use a Python script to execute a part of the process.

The way I'm doing at the moment the Delphi application calls an executable (my packaged Python script) and passes parameters via the command line, in response the Python script writes a file that is opened by the Delphi application.

For simpler situations this solution even passes, but as the complexity increases the little monster begins to show its claws. kkk

I've been researching and discovering named pipes that can be a solution to this communication. I did some Python tests for Python on Linux and it works great, but I need to run on Windows between Delphi and Python.

I just use Linux on all my machines and I have a VM with Win10 for Delphi and .NET development environment, as I said before, in Linux it was ball show, but in Windows the named pipe in> works differently.

I even managed to run my Python test for Python, but for Delphi it did not roll.

Does anyone have any examples of named pipes for Delphi?

Could be Delphi for Delphi myself, I turn to make Python work.

    

asked by anonymous 17.05.2017 / 04:25

1 answer

0

In github you have a set of components that "packs" a Python dll into Delphi and / or Lazarus, allowing you to easily execute python scripts. You can create python extensions like dlls, access to python's api, high-level bi-directional interaction between python and delphi, and more.

See the project description (in English):

  

Python for Delphi (P4D) is a set of free components that wrap up the Python dll into Delphi and Lazarus (FPC). They let you easily execute Python scripts, create new Python modules and new Python types. You can create Python extensions as dlls and much more. P4D provides different levels of functionality:

     
  • Low-level access to the python API
  •   
  • High-level bi-directional
  •   
  • interaction with Python Access to Python
  •   
  • objects using Delphi custom variants (VarPyth.pas)
  •   
  • Wrapping of Delphi objects for use in python   scripts using RTTI (WrapDelphi.pas)
  •   

P4D makes it very easy to use python as a scripting language for Delphi applications. It comes with an extensive range of demos and tutorials.

Download in github.

    
17.05.2017 / 20:45