The Python protocol
++++++++++++++++++++++
-The Python protocol is based on serialisation done by the cPickle module (C implementation of the pickle module).
+The Python protocol is based on serialisation done by the pickle module.
All that is necessary is to define an object reference type with the Python protocol so that Python objects
can be exchanged between Python inline nodes and with SALOME components implemented in Python.
SALOME components implemented in Python that are required to support this exchange type must be designed
way as the example in the run method described below::
def run(self,s):
- o=cPickle.loads(s)
+ o=pickle.loads(s)
ret={'a':6, 'b':[1,2,3]}
- return cPickle.dumps(ret,-1)
+ return pickle.dumps(ret,-1)
The json protocol
++++++++++++++++++++++
The json protocol is based on `JSON <http://www.json.org/>`_ (JavaScript Object Notation)
-serialisation / deserialisation instead of cPickle. JSON supports fewer data types and requires that
+serialisation / deserialisation instead of pickle. JSON supports fewer data types and requires that
the simplejson Python module should be installed, but it has the advantage that it is more interoperable.
In particular, there are C++ libraries that serialise/deserialise the JSON.
Definition of inline Python components
--------------------------------------------------
-Normally, a Python SALOME component must be developed outside YACS, either manually or using a SALOME module generator
-such as :ref:`yacsgen`.
+Normally, a Python SALOME component must be developed outside YACS.
A SALOME component implemented in Python can be defined directly in a Python script. This type of component
can be useful in test phases, for example.