py4cytoscape.sandbox.sandbox_remove_file

sandbox_remove_file(file_name, sandbox_name=None, base_url='http://127.0.0.1:1234/v1')[source]

Remove a file from a sandbox.

The named file is removed from the named sandbox. If the sandbox is the entire file system (i.e., for standalone Python execution), the file name can be an absolute path. Otherwise, it is a path relative to the named sandbox.

Note that there is no function that deletes a directory, except for sandbox_remove(), which deletes a sandbox and all of its contents.

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

  • 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’: <file’s absolute path in Cytoscape workstation>, ‘existed’: True if file existed before being deleted}

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_remove_file('test.png')
{'filePath': 'C:\Users\CyDeveloper\default_sandbox\test.png', 'existed': True}
>>> sandbox_remove_file('mySamples/workspace.cys', sandbox_name='mySand')
{'filePath': 'C:\Users\CyDeveloper\mySand\mySamples\workspace.cys', 'existed': False}

See also

Sandboxing in the Concepts section in the py4cytoscape User Manual.