Skip to content

Using GCS files - ValueError : Invalid local path or URI #570

@Bakame1

Description

@Bakame1

To whom it may concern,

I am trying to use files coming from my bucket in Google Cloud Storage in khiops v11.0.0.3.

Here is my test script :

# file paths (put "MYBUCKET" to not show u mine)
dictionary_file_path = "gs://MYBUCKET/Iris/Iris.kdic"
data_table_path = "gs://MYBUCKET/Iris/Iris.txt"
report_path = "gs://MYBUCKET/Iris/AnalysisResultsByPython_TEST.khj"

print(f"\nHere are the paths : \nkdic:{dictionary_file_path}\ndatatable:{dictionary_file_path}\nReport saved at :{report_path}")
print("\n#####")
print("Start of training")
print("#####\n")
try:
    # Train the predictor
    _, model_path = kh.train_predictor(
        dictionary_file_path,
        "Iris",  
        data_table_path,
        "Class",
        report_path,
        max_trees=0,
    )
    print("Sucess")
    print(f"Model saved at : {model_path}")

except Exception as e:
    print(f"Training failed: {str(e)}")
    import traceback
    traceback.print_exc()

After running it :

Image

@popescu-v told me :

  • to modify in api.py at line 867 : fs.parent_path by fs.get_parent_path
  • the problem comes from the fact that parent_path should be private from filesystems, only get_parent_path should be used

After I done the modification in my .venv, it solved the error, thank you @popescu-v 👍

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions