Skip to content

sliced_directory.py", line 26, in all_file_ids result = result + diffgram_files TypeError: can only concatenate list (not "bool") to list #9

Closed
@anthony-chaudhary

Description

@anthony-chaudhary
$ python diffgram_example_stream.py
Traceback (most recent call last):
  File "diffgram_example_stream.py", line 8, in <module>
    'labels.cars > 3')
  File "c:\python-sdk\sdk\diffgram\core\directory.py", line 146, in slice
    original_directory = self
  File "c:\python-sdk\sdk\diffgram\core\sliced_directory.py", line 14, in __init__
    self.file_id_list = self.all_file_ids()
  File "c:\python-sdk\sdk\diffgram\core\sliced_directory.py", line 26, in all_file_ids
    result = result + diffgram_files
TypeError: can only concatenate list (not "bool") to list

May be file list returning False

image

image

I'm not sure yet how we we want to handle raising exceptions in a case like this.

This specific case is appears to be from an invalid query - the label car exists but not cars plural.

Ideally it should warn the query is invalid becuase the label doesn't exist or something?

Maybe more generally we should raise query errors ?

Seems like at least 2 parts, hardening the handling if no files, and also better raising query exceptions rather then just bool False

Code to reproduce on lastest sdk

from diffgram import Project

coco_project = Project(project_string_id='coco-dataset') 

default_dataset = coco_project.directory.get(name='Default')

sliced_dataset = default_dataset.slice(
	'labels.cars > 3')

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions