Open anthony-chaudhary opened 2 years ago
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)
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 https://github.com/diffgram/python-sdk/issues/46#issuecomment-2263970833
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
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