You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

vas1992's avatar
vas1992
Helpful | Level 5
3 years ago

Sharing folder

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.

  • 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's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

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

    • vas1992's avatar
      vas1992
      Helpful | Level 5

      On Ubuntu 20.04 (worked)
      pip3 list

      dropbox 11.25.0

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

      dropbox (11.25.0)
      =====

      • Здравко's avatar
        Здравко
        Legendary | Level 20

        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!

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API

Make connections with other developers

797 PostsLatest Activity: 4 days ago
199 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!