py4cytoscape.sandbox.sandbox_get_from

sandbox_get_from(source_file, dest_file=None, overwrite=True, sandbox_name=None, base_url='http://127.0.0.1:1234/v1')[source]

Transfer a file from a sandbox.

The source file is transferred from the named (or current) sandbox to the Python workflow’s file system, overwriting an existing file if one already exists. The source_file can be an absolute path if the sandbox is the entire file system (i.e., for standalone Python execution) or a path relative to the sandbox (i.e., for Notebook or remote execution or if a sandbox was explicitly created).

Note that there is no function that transfers an entire directory.

Parameters
  • source_file (str) – Name of file to read (as absolute path or sandbox-relative path)

  • dest_file (str) – Name of file in the Python workflow’s file system … if None, use file name in source_file

  • sandbox_name (str) – Name of sandbox containing file. None means “the current sandbox”.

  • base_url (str) – Ignore unless you need to specify a custom domain, port or version to connect to the CyREST API. Default is http://localhost:1234 and the latest version of the CyREST API supported by this version of py4cytoscape.

Returns

{‘filePath’: <source file’s absolute path in Cytoscape workstation>}

Return type

dict

Raises
  • CyError – if file name is invalid

  • requests.exceptions.HTTPError – if can’t connect to Cytoscape, Cytoscape returns an error, or sandbox is invalid

Examples

>>> sandbox_get_from('test.png', 'C:\Users\CyDeveloper\Cytofiles\test.png', overwrite=True)
{'filePath': 'C:\Users\CyDeveloper\Cytofiles\test.png'}
>>> sandbox_get_from('mySamples/workspace.cys', 'C:\Users\CyDeveloper\Cytofiles\workspace.cys', sandbox_name='mySand')
{'filePath': 'C:\Users\CyDeveloper\Cytofiles\workspace.cys'}

See also

Sandboxing in the Concepts section in the py4cytoscape User Manual.