You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/python.md
+17-1Lines changed: 17 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -28,9 +28,21 @@ The `run()` function takes an arbitrary list of named arguments, where each argu
28
28
29
29
`run()` can output strings, numbers, `pathlib.Path` objects, or lists or dicts of those types. We are working on support for other types of output, but for now we recommend using base-64 encoded strings or `pathlib.Path`s for more complex outputs.
30
30
31
+
### Returning `pathlib.Path` objects
32
+
31
33
If the output is a `pathlib.Path` object, that will be returned by the built-in HTTP server as a file download.
32
34
33
-
## `@cog.input(name, type, default, help)`
35
+
To output `pathlib.Path` objects the file needs to exist, which means that you probably need to create a temporary file first. This file will automatically be deleted by Cog after it has been returned. For example:
0 commit comments