Module 'labelbox' has no attribute 'FileConverter'

Hi everyone. Quick Question the code that is suggested in the Download Pupup, labelled ‘Using the SDK’ no longer seems to work. I know for sure it worked two weeks ago but when running my unchanged code today it gave me this error:

AttributeError: module ‘labelbox’ has no attribute ‘FileConverter’

This is the code snippet im refering to:

import labelbox

LB_API_KEY = ''

client = labelbox.Client(api_key = LB_API_KEY)
export_task = labelbox.ExportTask.get_task(client, " ")

# Download the file to a local path
converter = labelbox.FileConverter(file_path="export-output.json")
export_task.get_stream(converter=converter).start()

# Stream the file to stdout
def json_stream_handler(output: labelbox.JsonConverterOutput):
  print(output.json_str)
export_task.get_stream().start(stream_handler=json_stream_handler)

While I cant find a reference to the FileConverter in the labelbox docs I also dont see anything in the most recent changelog about it being taken out. Am I the idiot here? What am I missing? I can still manually download the json so its fine but id still like to know why the default code that is suggested when you export stopped working.

Hey @luigikraken ,

Whats your SDK version? does

?? labelbox.FileConverter

returns anything?

Hi sorry, the version is : 6.0.1

and looking for the FileConverter it returns:
‘Object labelbox.FileConverter not found.’

Edit: Also tested it with 6.1 still the same issue

Actually, we did deprecated the class in 6.0.0 version of the SDK (ref: labelbox-python/libs/labelbox/CHANGELOG.md at develop · Labelbox/labelbox-python · GitHub) so here is a proposed alternate method.

client = lb.Client(api_key = LB_API_KEY)
export_task = lb.ExportTask.get_task(client, 'cm3geswy500t407142t90fi9y')
export_json = [data_row.json for data_row in export_task.get_buffered_stream()]
1 Like

Thanks must have missed it in the changelog.