Use python from Harbour via Ole.

266 views
Skip to first unread message

diego...@gmail.com

unread,
Dec 13, 2024, 1:39:19 PM (9 days ago) Dec 13
to Harbour Users

ramirez...@gmail.com

unread,
Dec 13, 2024, 2:12:14 PM (8 days ago) Dec 13
to Harbour Users
Excelente Diego, un mundo de posibilidades!

ramirez...@gmail.com

unread,
Dec 13, 2024, 2:12:39 PM (8 days ago) Dec 13
to Harbour Users
Me falto, muchas gracias por el aporte

El viernes, 13 de diciembre de 2024 a la(s) 11:39:19 a.m. UTC-7, diego...@gmail.com escribió:

hmpaquito

unread,
Dec 13, 2024, 5:32:48 PM (8 days ago) Dec 13
to Harbour Users
Gracias Diego, como siempre aportando a la comunidad.
No te estaremos suficientemente agradecidos

Eric Lendvai

unread,
Dec 14, 2024, 4:40:23 PM (7 days ago) Dec 14
to Harbour Users
Thanks for showing another way to integrate Python.
But I believe this is only working from MS windows.

Antonio Linares a while ago cracked how to actually integrate CPython in Harbour directly.
Using his example I extended it to a full sample for Windows and Linux:

diego...@gmail.com

unread,
Dec 14, 2024, 5:25:10 PM (7 days ago) Dec 14
to Harbour Users

Eric, Thank you for sharing your example showing the integrating CPython into Harbour directly. That is indeed an excellent option for those who require tight integration I posted that concept in https://github.com/diegofazio/hbPy.

However, I would like to emphasize the distinct advantages of the approach I showcased, which relies on generating a single executable using OLE to interact with Python. This method has several key benefits:

No Python Installation Required: My approach eliminates the need to have Python installed on the target system. This is particularly useful for distributing applications to end-users who may not have the technical expertise or permissions to install Python on their machines.
Simplified Deployment: Since the entire solution is packed into a single executable, deployment becomes straightforward. There’s no need to worry about bundling the CPython runtime or ensuring the compatibility of Python libraries across different environments.
Cross-System Consistency: While it's true that this specific implementation is tailored for Windows, the focus of my solution is on creating a lightweight, portable, and self-contained application for that platform. For projects exclusively targeting Windows, this approach minimizes dependencies and reduces maintenance overhead.
Flexibility: My method leverages OLE automation, allowing Harbour applications to communicate with Python scripts or libraries seamlessly. This separation keeps the Harbour code clean and Python code modular.
In my particular case, I have been using Python for electronic invoicing in my country for about 7 years. From my desktop system, I use OLE to perform digital signatures and all the necessary cryptographic operations. I cannot install Python with all its required dependencies on every client’s machine. That’s why I created a package and installer ready to handle this  

In my case, I don’t have desktop Linux clients using my system.  

Diego.

Eric Lendvai

unread,
Dec 14, 2024, 5:53:01 PM (7 days ago) Dec 14
to harbou...@googlegroups.com
Hello Diego,
Your choice makes sense for your requirements and being Windows specific. This also makes it easier to deal with Python Package dependencies.
Thank you for sharing your approach!
Best Eric

--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/HvP18XILshE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/912d91b3-899f-48d8-8fc4-b0fd06edadabn%40googlegroups.com.

Juank

unread,
Dec 16, 2024, 6:11:13 AM (6 days ago) Dec 16
to Harbour Users
Muy buen trabajo !
Muchas gracias Diego

JuanK

diego...@gmail.com

unread,
Dec 16, 2024, 1:55:03 PM (5 days ago) Dec 16
to Harbour Users
Eric, If I remember correctly, you are or were a vfox user. Here you have the same example working from vfox pro.

vfox.png
Diego.

Eric Lendvai

unread,
Dec 17, 2024, 3:47:04 AM (5 days ago) Dec 17
to Harbour Users
Thanks Diego, 
Yes you are correct I used to develop in VFP from version 1 to the latest 9 (MS).
But now I am a converted Harbour developer, almost exclusively in 64-bit Windows and Linux. I also ensure all my repos can run in Docker.
Best, Eric   :)

Reply all
Reply to author
Forward
0 new messages