py4cytoscape.sandbox.sandbox_get_file_info

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

Get metadata on file in sandbox (or entire sandbox).

If the current sandbox is the entire file system on a Cytoscape workstation, trying to delete it is an error. Otherwise, deleting the current sandbox results in the default sandbox becoming the new current sandbox. When running standalone on the same workstation as Cytoscape, the default sandbox is the entire file system on the Cytoscape workstation. When running in a Notebook or remote server, the default sandbox is the ‘default_sandbox’ created automatically under the under the filetransfer directory in the CytoscapeConfiguration directory. If that sandbox is deleted, it will be re-created so that subsequent file operations can complete successfully.

Note that this function can be used to query either a file or a directory.

Parameters
  • file_name (str) – Name of file whose metadata to return … can be sandbox-relative path … . returns metadata on sandbox itself

  • 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’: <full path on Cytoscape workstation>, ‘modifiedTime’: <last changed time, ‘’ if file doesn’t exist>, ‘isFile’: <True if file, False if directory>}

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_file_info('.')
{'filePath': 'C:\Users\CyDeveloper\CytoscapeConfiguration\filetransfer\default_sandbox', 'modifiedTime': '2020-09-24 14:10:08.0560', 'isFile': False}
>>> sandbox_get_file_info('test.png')
{'filePath': 'C:\Users\CyDeveloper\CytoscapeConfiguration\filetransfer\default_sandbox\test.png', 'modifiedTime': '2020-09-24 14:10:08.0560', 'isFile': True}
>>> sandbox_get_file_info('test.png', sandbox_name='mySand')
{'filePath': 'C:\Users\CyDeveloper\CytoscapeConfiguration\filetransfer\mySand\test.png', 'modifiedTime': '2020-09-24 14:10:08.0560', 'isFile': True}

See also

Sandboxing in the Concepts section in the py4cytoscape User Manual.