<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Incorrect type expected on upload [ Python ] in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Incorrect-type-expected-on-upload-Python/m-p/331367#M503</link>
    <description>&lt;P&gt;The&amp;nbsp;files_upload method expects a string, but you're passing in a file object. You'll need to update your code to pass in a string, e.g., try passing in `f.read()` instead of `f`.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Feb 2019 16:46:24 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2019-02-28T16:46:24Z</dc:date>
    <item>
      <title>Incorrect type expected on upload [ Python ]</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Incorrect-type-expected-on-upload-Python/m-p/331247#M501</link>
      <description>&lt;P&gt;So Im trying to upload some multiple files using API, but in the end I just getting&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;dropbox.stone_validators.ValidationError: '&amp;lt;_io.BufferedReader name='./image_01.jpg'&amp;gt;' expected to be a string, got BufferedReader&lt;/PRE&gt;&lt;P&gt;My code:&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;def image_uploader(filename):

    filename_lower = filename.lower()

    for ignored_file in IGNORED_FILES:
        if ignored_file in filename_lower:
            return True

    return False


local_dir = '.'
dbx_token = dropbox.Dropbox('MY_API_TOKEN')


for root, dirs, files in os.walk(local_dir):

    for file_name in files:
        if image_uploader(file_name):
            continue

        local_path = os.path.join(root, file_name)
        relative_path = os.path.relpath(local_path, local_dir)
        dropbox_path = os.path.join('/Apps/face_db_upload', relative_path)

        with open(local_path, 'rb') as f:
            dbx_token.files_upload(dropbox_path, f)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:05:06 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Incorrect-type-expected-on-upload-Python/m-p/331247#M501</guid>
      <dc:creator>YevhenRadchenko</dc:creator>
      <dc:date>2019-05-29T09:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Incorrect type expected on upload [ Python ]</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Incorrect-type-expected-on-upload-Python/m-p/331367#M503</link>
      <description>&lt;P&gt;The&amp;nbsp;files_upload method expects a string, but you're passing in a file object. You'll need to update your code to pass in a string, e.g., try passing in `f.read()` instead of `f`.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 16:46:24 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Incorrect-type-expected-on-upload-Python/m-p/331367#M503</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2019-02-28T16:46:24Z</dc:date>
    </item>
  </channel>
</rss>

