This topic was automatically generated from Slack. You can find the original thread here.
Hey all, so i currently have a pipedream automation that leverages a python code step. this python code step uses PIL and a locally stored font to create an image. unfortunately i don’t see a way to persist local files so i’ve been storing the font file in an s3 bucket and pulling it down every time i want to run it. does anyone know of a better way to do this?
i’m trying to open a file i stored in the file store, but i am getting the error that the file does not exist. I started by listing out all files, grabbing one of the file names and trying to open it, but i got the following error:
[Errno 2] No such file or directory: 'HelveticaNeueBlack.otf'
it looks like i may need to download the file to tmp in node in order to use it in python. is that correct?
It seems like you’re encountering an issue where the file you want to access isn’t available in the /tmp directory, which is the only writable directory in Pipedream workflows. To resolve this, you need to ensure that the file is downloaded to the /tmp directory before you attempt to open it in Python. Here’s a step-by-step approach to achieve this: 1. Download the File to /tmp in Node.js: First, use a Node.js step to download the file from your file store to the /tmp directory. 2. Access the File in Python: Once the file is in the /tmp directory, you can access it in a Python step. ### Example Workflow #### Node.js Step: Download the File import { axios } from "@pipedream/platform"; export default defineComponent({ async run({ steps, $ }) { const fileUrl = "URL_OF_YOUR_FILE"; // Replace with your file URL const filePath = "/tmp/HelveticaNeueBlack.otf"; // Path to save the file const response = await axios($, { url: fileUrl, responseType: "arraybuffer", }); require("fs").writeFileSync(filePath, response); return filePath; // Return the file path for use in the next step }, }); #### Python Step: Open the File def handler(pd: "pipedream"): file_path = pd.steps["previous_step_name"]["$return_value"] # Use the return value from the Node.js step with open(file_path, "rb") as f: file_data = f.read() # Process your file data here print(file_data) ### Explanation - Node.js Step: This step downloads the file from a specified URL and saves it to the /tmp directory. Make sure to replace "URL_OF_YOUR_FILE" with the actual URL of your file. - Python Step: This step opens the file from the /tmp directory using the path returned by the Node.js step. You can then process the file data as needed. By following these steps, you should be able to access and process your file without encountering the “No such file or directory” error. If you have any further questions or run into issues, feel free to ask for more help!
It seems like George is trying to use File Stores in Pipedream. Here are some key points about File Stores that might help: 1. Availability: File Stores are only available to workspaces subscribed to the Advanced plan and above. You can check or change your plan on the Pipedream pricing page. 2. Accessing File Stores: You can access a File Store by opening the Project in the Pipedream Dashboard and selecting the File Store from the left-hand navigation menu. For more detailed information, you can refer to the Pipedream File Stores documentation. If George is experiencing any issues or needs further assistance, it might be helpful to visit Pipedream Support for more support options.
Oh yea, Pi is great — feel free to @ pi in this Slack workspace whenever you want, it’s totally trained on all Pipedream docs and many of the docs for our integrated apps as well.