AttributeError: 'function' object has no attribute 'info'

super_bulldog Registered Posts: 8

Hi Dataiku community,

I encountered the AttributeError as shown in the title when I ran a Python recipe that was created from a notebook. The notebook runs correctly (without any error), but when it is converted into a Python recipe. The AttributeError was thrown immediately after the recipe finished executing the last line of the code right before the recipe output block.

The AttributeError was from the file and I could not access its content to debug the error.

The Traceback is shown below.

Traceback (most recent call last):
File "/data/dataiku/data_dir/jobs/MLOPS/Build_from_recipe_from_notebook_1_create_input_dataset_2024-03-23T13-49-56.329/recipe_from_notebook_4_build_model_NP/python-recipe/pyoutSlgc2L5Bc1ba/", line 266, in <module>"Check if spark is available")
AttributeError: 'function' object has no attribute 'info'.

Please advise!


Operating system used: Windows 10 64-bit

Best Answer

  • Zach
    Zach Dataiker, Dataiku DSS Core Designer, Dataiku DSS Adv Designer, Registered Posts: 153 Dataiker
    edited July 17 Answer ✓

    Hi @super_bulldog

    Based on the stack trace, it looks like you have a function called "logging" in your recipe, which is conflicting with the "logging" module.

    For example, I was able to reproduce the error with the following recipe:

    import dataiku
    import pandas as pd
    # This function is causing the error
    def logging():
    df = pd.DataFrame(
        [{"str": "foo", "int": 1}, {"str": "bar", "int": 2}]
    dataset = dataiku.Dataset("MY_DATASET")

    You can avoid the issue by renaming the function.


Setup Info
      Help me…