Skip to content

directory_id' not supplied on init #26

Open

Description

@anthony-chaudhary

When trying to run a basic SDK example just loading a project, the extra info is {'errors': ["'directory_id' not supplied"], 'success': False}

but a directory_id is supplied if I do
image

Related this is an old endpoint, doesn't use schema
https://github.com/diffgram/diffgram/blob/80e0284d4e98a8261adb475e32c1a69dcb5a0b58/default/methods/annotation/labels/view.py#L31

not sure where we left the new Schema upgrade on SDK side

Traceback (most recent call last):
  File "C:\AnthonyCodePlay\diffgram_play\aaaaa.py", line 3, in <module>
    project = Project(
  File "C:\Python310\lib\site-packages\diffgram\core\core.py", line 56, in __init__
    self.auth(
  File "C:\Python310\lib\site-packages\diffgram\core\core.py", line 212, in auth
    self.get_label_file_dict()
  File "C:\Python310\lib\site-packages\diffgram\file\view.py", line 56, in get_label_file_dict
    if data["log"]["success"] == True:
KeyError: 'log'

Activity

  1. JKYang01 commented on Aug 1, 2024

    @JKYang01

    Hi diffgram team,
    I encountered this error while I am trying to import the files from url
    I created a project with following code

    project = Project(
      host = "http://localhost:8085",
      project_string_id = os.getenv("project_string_id"),
      client_id = os.getenv("client_id"),
      client_secret = os.getenv("client_secret"))
    

    then I was testing:
    project.file.from_url(signed_url)

    and it gives me this error:

    ---------------------------------------------------------------------------
    Exception                                 Traceback (most recent call last)
    File ~/miniconda3/envs/diffgram/lib/python3.10/site-packages/diffgram/core/core.py:255, in Project.handle_errors(self, response)
        254 try:
    --> 255     raise Exception(response.json()["log"]["error"])
        256 except:
    
    Exception: {'directory': "'directory_id' not supplied"}
    
    During handling of the above exception, another exception occurred:
    
    Exception                                 Traceback (most recent call last)
    Cell In[7], line 5
          2 signed_url_list = s3utility().generate_public_url(s3folder)
          4 for signed_url in signed_url_list:
    ----> 5     result = project.file.from_url(signed_url)
          6     #file_list.append(result)
          7     print(result)
    
    File ~/miniconda3/envs/diffgram/lib/python3.10/site-packages/diffgram/file/file_constructor.py:268, in FileConstructor.from_url(self, url, media_type, job, job_id, video_split_duration, instance_list, frame_packet_map, parent_file_id, ordinal)
        234 """
        235 
        236 {'frame_packet_map' : {
       (...)
        254 
        255 """
        257 packet = self.__build_packet_payload(
        258     url = url,
        259     media_type = media_type,
       (...)
        266     ordinal = ordinal
        267 )
    --> 268 self.from_packet(packet = packet)
        270 return True
    
    File ~/miniconda3/envs/diffgram/lib/python3.10/site-packages/diffgram/file/file_constructor.py:397, in FileConstructor.from_packet(self, packet, job, convert_names_to_label_files, assume_new_instances_machine_made)
        390 endpoint = "/api/walrus/v1/project/" + \
        391            self.client.project_string_id + "/input/packet"
        393 response = self.client.session.post(
        394     self.client.host + endpoint,
        395     json = packet)
    --> 397 self.client.handle_errors(response)
        399 data = response.json()
        401 # TODO better handling input vs file
    
    File ~/miniconda3/envs/diffgram/lib/python3.10/site-packages/diffgram/core/core.py:257, in Project.handle_errors(self, response)
        255         raise Exception(response.json()["log"]["error"])
        256     except:
    --> 257         raise Exception(response.text)
        259 if response.status_code == 403:
        260     raise Exception("Invalid Permission", response.text)
    
    Exception: {
      "log": {
        "error": {
          "directory": "'directory_id' not supplied"
        },
        "info": {},
        "success": false
      }
    }
    
    

    i don't know how to put the directory_id and why the directory_id is not supplied.

    I tried ruuning

    dir = project.directory.get('Default')
    print(dir.id)
    

    it gives me the result which is 1 ( the ID of Default folder)

  2. JKYang01 commented on Aug 2, 2024

    @JKYang01

    lol I fixed it. here is the relevant comment i made under the issue: #46 Unable to ingest data
    description: 'directory_id' not supplied when using from_url() function to ingest data
    #46 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy