Recent

Author Topic: Pickle (python stream) and free pascal  (Read 767 times)

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Pickle (python stream) and free pascal
« on: November 17, 2020, 12:40:46 pm »
Hello, I'm working on program which receives and sends info using Zmq https://zeromq.org/. No problem in this point.
But the program receives the information from a python program, the python program stream the info  the info using Pickle
Code: [Select]
#Python code
 msg = pickle.dumps(obj, protocol)

Is there any way to manage this data format in pascal?

Thanks in advance

/BlueIcaro

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Pickle (python stream) and free pascal
« Reply #1 on: November 17, 2020, 12:50:36 pm »
Pickle seems to be a Python specific object format. https://docs.python.org/3/library/pickle.html

https://wiki.python.org/moin/IntegratingPythonWithOtherLanguages seem to only mention one foreign binding (based on a generator, maybe not practical?) for C++

A workaround could be embedding python 4 delphi, and loading it in the embedded python interpreter, and then trying to marshal it via python4delphi.

But in general, I it would make sense to rewrite python to use a better supported fileformat

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: Pickle (python stream) and free pascal
« Reply #2 on: November 17, 2020, 01:09:25 pm »
Thanks Marcov, I think is more sense use a standard format, as you said.

So, we'll use json structure to communique as thought in my first approach to the problem. But I was wondering if it could be used.

It will be one less headache.

Thanks

/BlueIcaro

 

TinyPortal © 2005-2018