Newbie question - I am getting this error when I t...
# prefect-community
t
Newbie question - I am getting this error when I try to register my flow.
Copy code
File "C:\etls\tractor_hours_analyzer\tractor_hours_analyzer.py", line 89, in <module>
    transformed = transform_add_files_to_dataframe(extracted)
    raise TypeError('too many positional arguments') from None
    TypeError: too many positional argumentswith
k
Can you show the
transform_add_files_to_dataframe
task definition?
t
Copy code
def transform_add_files_to_dataframe():
    cwd = os.path.abspath('\\etls\\tractor_hours_analyzer')
    files = os.listdir(cwd)
    df = pd.DataFrame()
    for file in files:
        if file.endswith('.xlsx'):
            df = df.append(pd.read_excel(file), ignore_index=True)
    df.head()
    return df
k
But you are passing something called
extracted
to that but it doesn’t accept anything
t
with Flow("tractor_hours_analyzer") as flow: extracted = extract_hours_from_website() transformed = transform_add_files_to_dataframe(extracted) load = load_into_database(transform) clean_up_directory(load)
k
Are you trying to pass something to it or just set an upstream dependency?
t
It's when I declare my flow for the dependencies. I have done it that way before.
Upstream dependency
k
You can do it if
transform_add_files_to_dataframe
accepted something. Otherwise you can do
Copy code
with Flow() as flow:
    a = task_a()
    b = task_b(upstream_tasks=[a])
The issue here is the task doesn’t accept input
t
ahh makes sense.
I just added a variable to it and it worked for me. Thanks for your help!
k
Sure!