This topic was automatically generated from Slack. You can find the original thread here.
HI I have been struggling for one day now to download a file from Google drive and read the file with a python script for processing.
Below my python code to load the file (from your support page) I get an error message: No such file in directory
No matter what combination I use cannot access the file downloaded from Google Drive in the previous step.
I am expecting the file to be in the tmp directory with the original file name?
import os
def handler(pd: "pipedream"):
# Reference data from previous steps
filepath = pd.steps["download_file"]["$return_value"]["name"]
print(filepath)
with open('/tmp/'+filepath) as f:
# Store the contents of the file into a variable
file_data = f.read()
# Return data for use in future steps
return {"python_output": {"filepath": filepath}}
Hi , I think your question is a great case for Pipedream bot to help. I’ll pass your question to the Pipedream bot now. Please feel free to ask it any question
HI I have been struggling for one day now to download a file from Google drive and read the file with a python script for processing.
Below my python code to load the file (from your support page) I get an error message: No such file in directory
No matter what combination I use cannot access the file downloaded from Google Drive in the previous step.
I am expecting the file to be in the tmp directory with the original file name?
import os
def handler(pd: "pipedream"):
# Reference data from previous steps
filepath = pd.steps["download_file"]["$return_value"]["name"]
print(filepath)
with open('/tmp/'+filepath) as f:
# Store the contents of the file into a variable
file_data = f.read()
# Return data for use in future steps
return {"python_output": {"filepath": filepath}}
I’m sorry to hear that you’re having trouble with your workflow. I took a look at your workflow and it seems like the issue might be related to the file path or the download step. To help you better, I need more information about the step where you download the file from Google Drive. Can you please share the code or configuration for that step? This will help me understand how the file is being downloaded and saved to the /tmp directory.