harsimrans / DropboxSyncer

dropbox-sync: Automatic RealTime Sync for Dropbox folders
MIT License
16 stars 6 forks source link

Error uploading file #19

Open RichardBronosky opened 6 years ago

RichardBronosky commented 6 years ago

I'm using Python 3.5.3 on an RPi

Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': ['iptables_manager.tar'], 'deleted': [], 'deleted_dirs': [], 'created': []}
updated:  iptables_manager.tar
push uploading to new thread...
Error uploading file:  /home/pi/synced/iptables_manager.tar
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
Changes:  []
client changes
diffs:  {'updated': [], 'deleted': [], 'deleted_dirs': [], 'created': []}
harsimrans commented 6 years ago

Is this error occurring for all the files? or just the tar files?

RichardBronosky commented 6 years ago

I only tried the one file. I then wrote my own (but it doesn't sync bidirectionally).

bxff commented 4 years ago

It's happening here too, my python venv files are not able to upload it just goes on a loop :<

Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/objc/__pycache__/_compat.cpython-36.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/objc/__pycache__/_compat.cpython-36.pyc
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/commands/__pycache__/uninstall.cpython-36.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/commands/__pycache__/uninstall.cpython-36.pyc
Uploading Python/PyProjects/MakoEdit/venv/Lib/site-packages/PyQt5/Qt/translations/qt_help_da.qm
Error uploading file:  /root/Dropbox/Python/PyProjects/MakoEdit/venv/Lib/site-packages/PyQt5/Qt/translations/qt_help_da.qm
Uploading Python/PyProjects/Anti-VPN/venv/Lib/site-packages/urllib3/contrib/_appengine_environ.py
Error uploading file:  /root/Dropbox/Python/PyProjects/Anti-VPN/venv/Lib/site-packages/urllib3/contrib/_appengine_environ.py
Uploading Python/PyProjects/Extra/.idea/misc.xml
Error uploading file:  /root/Dropbox/Python/PyProjects/Extra/.idea/misc.xml
Uploading Python/PyProjects/Extra/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/req_uninstall.py
Error uploading file:  /root/Dropbox/Python/PyProjects/Extra/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/req_uninstall.py
Uploading Python/PyProjects/RobloxPhantomForces/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/msgpack/__pycache__/_version.cpython-37.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/RobloxPhantomForces/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/msgpack/__pycache__/_version.cpython-37.pyc
Uploading Python/PyLibrarys/venv/Lib/site-packages/chardet/jpcntx.py
Error uploading file:  /root/Dropbox/Python/PyLibrarys/venv/Lib/site-packages/chardet/jpcntx.py
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/chardet/__pycache__/langhebrewmodel.cpython-36.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/chardet/__pycache__/langhebrewmodel.cpython-36.pyc
Uploading Python/PyProjects/Anti-VPN/venv/Lib/site-packages/requests/cookies.py
Error uploading file:  /root/Dropbox/Python/PyProjects/Anti-VPN/venv/Lib/site-packages/requests/cookies.py
Uploading Python/PyProjects/WebBlocker/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/wheel.py
Error uploading file:  /root/Dropbox/Python/PyProjects/WebBlocker/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/commands/wheel.py
Uploading Python/PyProjects/RobloxPhantomForces/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py
Error uploading file:  /root/Dropbox/Python/PyProjects/RobloxPhantomForces/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/packages/ssl_match_hostname/_implementation.py
Uploading Python/PyProjects/Extra/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/util/url.py
Error uploading file:  /root/Dropbox/Python/PyProjects/Extra/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/util/url.py
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/req/req_set.py
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/req/req_set.py
Uploading Python/PyProjects/Anti-VPN/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__pycache__/req_file.cpython-37.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/Anti-VPN/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/req/__pycache__/req_file.cpython-37.pyc
Uploading Python/PyLibrarys/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/encoding.py
Error uploading file:  /root/Dropbox/Python/PyLibrarys/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_internal/utils/encoding.py
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/__pycache__/download.cpython-36.pyc
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/__pycache__/download.cpython-36.pyc
Uploading Python/PyProjects/PhantomForces/venv/Lib/site-packages/selenium/webdriver/remote/errorhandler.py
Error uploading file:  /root/Dropbox/Python/PyProjects/PhantomForces/venv/Lib/site-packages/selenium/webdriver/remote/errorhandler.py
Uploading Python/PyProjects/StartRainmeter/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/colorama/initialise.py
Error uploading file:  /root/Dropbox/Python/PyProjects/StartRainmeter/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/colorama/initialise.py
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/vcs/git.py
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pip-10.0.1-py3.6.egg/pip/_internal/vcs/git.py
Uploading Python/PyLibrarys/bitglitter/palettes/__pycache__/palettefunctions.cpython-37.pyc
Error uploading file:  /root/Dropbox/Python/PyLibrarys/bitglitter/palettes/__pycache__/palettefunctions.cpython-37.pyc
Uploading Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pynput/__init__.py
Error uploading file:  /root/Dropbox/Python/PyProjects/KeyLogger/venv/lib/python3.6/site-packages/pynput/__init__.py
Uploading Python/PyProjects/MakoEdit/venv/Lib/site-packages/PyQt5/Qt/bin/Qt5Svg.dll
Error uploading file:  /root/Dropbox/Python/PyProjects/MakoEdit/venv/Lib/site-packages/PyQt5/Qt/bin/Qt5Svg.dll
Uploading Python/PyProjects/WebBlocker/venv/Lib/site-packages/pip-10.0.1-py3.7.egg/pip/_vendor/urllib3/util/ssl_.py

Its not only tar files its .py, .egg etc files too:- I also noticed that most of these files are 0 bytes not sure if all, or its just a thing about venv, but I do think that might be the problem @harsimrans

@Shobhim Could you please comforme that your iptables_manager.tar file is of 0 bytes size?

bxff commented 4 years ago

Also, This takes place between lines 203 to 207 in the upload function:

def upload_file(dbx, file_path, path):   
    ''' code here... '''

    f = open(file_path)
    file_size = os.path.getsize(file_path)

    CHUNK_SIZE = 4 * 1024 * 1024

    if file_size <= CHUNK_SIZE:
        try:
            print(dbx.files_upload(f.read(), path, mode=dropbox.files.WriteMode.overwrite))
        except:
            print("Error uploading file: ", file_path)

    ''' code here... '''
bxff commented 4 years ago

when I print out the error it comes out to be this:

expected request_binary as binary type, got <class 'str'>

The fix was very easy, all it had to do is open the file with 'rb' so that it reads binary of the file. Heres a PR for the issue #21

harsimrans commented 4 years ago

@bin0x00 Thanks for debugging and putting up the PR. I have merged the PR!