cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Sharing folder

Sharing folder

vas1992
Helpful | Level 5
Go to solution

Hello! I have a problem getting (and create) a link to a public folder in python:

 

dbx.sharing_create_shared_link(DxFold)

dbx.sharing_get_shared_links(DxFold)

 

Everything works in python version 3.8.10 However, when running on a RaspberryPi 3B + running version 3.4. an error message appears:

=============================================================
[code]
Traceback (most recent call last):
File "/home/pi/UploadDx/DxRMS.py", line 85, in <module>
sharedlink = dbx.sharing_get_shared_links(DxFold).links[0].url
File "/home/pi/.local/lib/python3.4/site-packages/dropbox/base.py", line 4350, in sharing_get_shared_links
None,
File "/home/pi/.local/lib/python3.4/site-packages/dropbox/dropbox_client.py", line 345, in request
returned_data_type, obj, strict=False)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 978, in json_compat_obj_decode
data_type, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 558, in json_compat_obj_decode_helper
return self.decode_struct(data_type, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 607, in decode_struct
self.decode_struct_fields(ins, all_fields, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 626, in decode_struct_fields
v = self.json_compat_obj_decode_helper(field_data_type, obj[name])
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 566, in json_compat_obj_decode_helper
data_type, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 844, in decode_list
for item in obj]
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 844, in <listcomp>
for item in obj]
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 556, in json_compat_obj_decode_helper
return self.decode_struct_tree(data_type, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 797, in decode_struct_tree
return self.decode_struct(subtype, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 607, in decode_struct
self.decode_struct_fields(ins, all_fields, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 626, in decode_struct_fields
v = self.json_compat_obj_decode_helper(field_data_type, obj[name])
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 563, in json_compat_obj_decode_helper
return self.decode_union(data_type, obj)
File "/home/pi/.local/lib/python3.4/site-packages/stone/backends/python_rsrc/stone_serializers.py", line 662, in decode_union
return data_type.definition(six.ensure_str(tag), val)
AttributeError: 'module' object has no attribute 'ensure_str'
[/code]

====================================================

How can I fix this on the current version of python3.4? You can't put anything on raspberries - that's the root of the problem. Tell me who understands.

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

Hi @vas1992,

Yes, 'six' module is part of Python standard distribution and that's why preinstalled, of course.


@vas1992 wrote:

...

 

(vRMS) pi@RU000Q:~/source/RMS $ python3 -m pip show six
Name: six
Version: 1.8.0
...

 


Your version (1.8.0) is far old! 🤷 At that time 'ensure_str' isn't part of 'six' and that's why missing in your code. For first time it appears in some releases of version 1.11 and finally became part of the standard distribution in version 1.12.0.

You have to update your 'six' version, at least 1.12 or newer, or even better update entire Python distribution to more recent one. 😉

Hope this helps.

View solution in original post

7 Replies 7

Greg-DB
Dropbox Staff
Go to solution

What version of 'dropbox' do you have installed, and what version of 'six' do you have installed?

vas1992
Helpful | Level 5
Go to solution

On Ubuntu 20.04 (worked)
pip3 list

dropbox 11.25.0

===============================
RPi 3B+ (No work)
python3 -m pip list

dropbox (11.25.0)
=====

Здравко
Legendary | Level 20
Go to solution

Hi @vas1992,

@Greg-DB  asked you for result of a command like:

pip3 show six

or another option:

python3 -m pip show six

Whatever you prefer. 😉 Function 'ensure_str' should come up there, that seems missing now for some reason.

 

In addition you can find out your six.py place by using following on command line:

echo "import six; print('path to six:', six.__file__)" | python3

 ... and inspect byself what's there - is there such a function defined or referred/redirected by some way 🧐. Normally there should be.

 

Good luck and happy New Year!

vas1992
Helpful | Level 5
Go to solution

Thank you. 'Six' was already installed:

(vRMS) pi@RU000Q:~/source/RMS $ python3 -m pip show six
Name: six
Version: 1.8.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin@python.org
License: MIT
Location: /usr/lib/python3/dist-packages
Requires:
(vRMS) pi@RU000Q:~/source/RMS $ echo "import six; print('path to six:', six.__file__)" | python3
path to six: /usr/lib/python3/dist-packages/six.py
(vRMS) pi@RU000Q:~/source/RMS $ 

Здравко
Legendary | Level 20
Go to solution

Hi @vas1992,

Yes, 'six' module is part of Python standard distribution and that's why preinstalled, of course.


@vas1992 wrote:

...

 

(vRMS) pi@RU000Q:~/source/RMS $ python3 -m pip show six
Name: six
Version: 1.8.0
...

 


Your version (1.8.0) is far old! 🤷 At that time 'ensure_str' isn't part of 'six' and that's why missing in your code. For first time it appears in some releases of version 1.11 and finally became part of the standard distribution in version 1.12.0.

You have to update your 'six' version, at least 1.12 or newer, or even better update entire Python distribution to more recent one. 😉

Hope this helps.

Greg-DB
Dropbox Staff
Go to solution

That's correct, v11.25.0 of the 'dropbox' library depends on at least v1.12.0 of 'six', so you need at least that version to get this working.

vas1992
Helpful | Level 5
Go to solution

Thanks! Everything worked as it should!

Need more support?