Class PythonResource
java.lang.Object
edu.cmu.tetrad.util.PythonResource
A utility class for working with Python-related resources. This class provides methods
to extract classpath resources into a stable user cache directory, ensuring that
Python scripts or files can be accessed in a way that supports long-lived processes.
Instances of this class cannot be created as it is designed to be a static utility class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic PathextractToUserCache(String resourcePath, String cacheFileName) Extracts a classpath resource to a stable cache directory (not a temp file), so a long-lived Python process can safely run it.
-
Method Details
-
extractToUserCache
Extracts a classpath resource to a stable cache directory (not a temp file), so a long-lived Python process can safely run it.- Parameters:
resourcePath- classpath resource path, e.g. "python/kci_server.py"cacheFileName- file name to use in the cache dir, e.g. "kci_server.py"- Returns:
- the extracted file path
- Throws:
IOException- if the resource cannot be extracted or accessed
-