Problem:
You need to know the file name and path of your current report. Or you want to know the library ID.
Solution:
The following script will gather details of the current report and populate 3 different document properties (that you need to create before hand).
from Spotfire.Dxp.Application import DocumentMetadata
dmd = Application.DocumentMetadata #Get MetaData
lib = dmd.LoadedFromLibraryItem
Document.Properties["GUID"] = str(lib.Id) # Library Item IDDocument.Properties["PATH"] = dmd.LoadedFromLibraryPath # Library Path
Document.Properties["FILE"] = dmd.LoadedFromFileName # File path
Details of these methods can be found via the Spotfire API documentation: https://docs.tibco.com/pub/doc_remote/spotfire/7.9.0/TIB_sfire-analyst_7.9.0_api/html/T_Spotfire_Dxp_Application_DocumentMetadata.htm