download_file#
- pytwin.download_file(file_name, directory, force_download=False, destination=None)#
Download a file that is used for a PyTwin example.
The files are downloaded from the PyTwin example files repository whose URL is given by the
pytwin.examples.downloads.EXAMPLES_REPO
constant. All example files are downloaded to a persistent cache to avoid downloading the same file twice.- Parameters:
- file_name
str
Name of the example file.
- directory
str
Path to the directory in the example files repository where the example file is stored.
- force_downloadbool,
optional
Whether to force deletion of an example file so that it can be downloaded again. The default is
False
.- destination
str
,optional
Path to download the example file to. The default is
None
, in which case the example file is downloaded to the user’s temporary folder.
- file_name
- Returns:
str
Path to the downloaded example file.
Examples
>>> from pytwin import download_file >>> path = download_file("CoupledClutches_23R1_other.twin", "twin_files", force_download=True)