imagekit-developer/imagekit-python

"AttributeError: 'dict' object has no attribute '__dict__' "

Closed this issue · 5 comments

getting the following error while uploading images.

File "/home/runner/.local/lib/python3.8/site-packages/imagekitio/client.py", line 74, in upload_file
return self.file.upload(
File "/home/runner/.local/lib/python3.8/site-packages/imagekitio/file.py", line 93, in upload
options = self.validate_upload(options.dict)
AttributeError: 'dict' object has no attribute 'dict'
Error: Process completed with exit code 1.

Which version of SDK are you using? Please test with the latest version.

im using latest one by doing to back to this "pip install imagekitio==2.2.8" it got solved

@lokeshcloudy please share details of the code where the "upload_file" method is called (you can remove out any sensitive info)

As of 3.0.0, the options for upload_file() are changed from a dict to the UploadFileRequestOptions() class. This is not covered in any changelog, but is updated in the readme.

2.2.8 and prior:

ImageKit.upload_file(..., options={'folder':'path/for/imagekit'})

3.0:

options=ImageKit.models.UploadFileRequestOptions(
    folder='path/for/imagekit'
)
ImageKit.upload_file(..., options=options)

As of 3.0.0, the options for upload_file() are changed from a dict to the UploadFileRequestOptions() class. This is not covered in any changelog, but is updated in the readme.

2.2.8 and prior:

ImageKit.upload_file(..., options={'folder':'path/for/imagekit'})

3.0:

options=ImageKit.models.UploadFileRequestOptions(
    folder='path/for/imagekit'
)
ImageKit.upload_file(..., options=options)

thanks for writing this. this fixed my problem!