Copying Python Objects from the UI#

Some fields in the Graph View are copyable as string-serialized Python objects. These copyable Python objects include the Input and Result fields in the Lattice Sidebar and the Electron Sidebar, and are identified by the message Copy python object when you mouse over the field.

To copy a Python object field, mouse over the field and click. The object is copied as a byte stream wrapped in a pickle.loads() statement. To view the data object, paste the string into a Python interpreter or notebook and execute it.


The Python environment in which you view the pickled data structure must contain all packages on which it depends.

For example, the following string was copied from a simple input in the Covalent GUI Electron Sidebar Input text field:

import pickle

Executing the string in a Jupyter notebook yields the input as displayed in the Input text field:

{'args': ('100',), 'kwargs': {}}


This might seem like unnecessary extra work for such a simple data structure. For complex data structures, however, using the pickled object is less error-prone than trying to copy and paste the text representation. An example of such a complex data structure is the construct_cu_slab result in this example. The example, an atomistic simulation, requires the ase package.