Problem when downloading from Storj to Google Drive


AttributeError Traceback (most recent call last)
in ()
33 download = project.download_object(MY_BUCKET, MY_STORJ_UPLOAD_PATH)
34 _ = download.read(21000)
—> 35 download.read_file(file_handle)
36 _ = download.info()
37 download.close()

1 frames
/usr/local/lib/python3.7/dist-packages/uplink_python/download.py in read(self, size_to_read)
88 if bool(read_result.error):
89 raise _storj_exception(read_result.error.contents.code,
—> 90 read_result.error.contents.message.decode(“utf-8”))
91
92 data_read = bytes()

AttributeError: ‘NoneType’ object has no attribute ‘decode’

Hello @Tharwat.elsayed ,
Welcome to the forum!

I can assume that you trying to use GitHub - storj-thirdparty/uplink-python: Python bindings for libuplink
Have you changed uplink-python/hello_storj.py at efba0bc50803599d4570376ad1fd737e0db65b46 · storj-thirdparty/uplink-python · GitHub to the correct values?
You can take them following this guide: Create Access Grant in CLI | Storj Docs

If it’s supposed to be a scheduled task, I would like to suggest to take a look on Sync Files With Rclone | Storj Docs
The rclone will allow you to configure both - Storj DCS remote and Google Drive remote as well, then your sync could be done like this

rsync sync google-drive:/ storj-dcs:/
1 Like

Dear Alexey,
I would like to thank you for your interest, and i want to tell you that the problem solved by changing the code to:

download = project.download_object(MY_BUCKET, MY_STORJ_UPLOAD_PATH)
download.read_file(file_handle)
download.close()

1 Like

This code looks exactly like in

What’s the difference?

1 Like

Dear Alexey,
You are right,

My error message was
" AttributeError: ‘NoneType’ object has no attribute ‘decode’ "

was because i use google colab environment

when i removed those two lines from my code
34 _ = download.read(21000)
36 _ = download.info()

the problem solved and the colab environment run the code without any error.

Many thanks.

1 Like