Program reads all the files data from the file server shared location and insert data into the database
Here is the code:
class MetrologyObserver(object):
def __init__(self, root_path):
self.root_path = root_path
self.event_handler = MetrologyEventHandler()
self.event_observer = Observer()
def run(self):
self.schedule()
self.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
self.stop()
self.event_observer.join()
def start(self):
self.event_observer.start()
def stop(self):
self.event_observer.stop()
def schedule(self):
self.event_observer.schedule(self.event_handler,
self.root_path,
recursive=True)
if __name__ == "__main__":
src_path = r'\\shared folder path'
MetrologyObserver(src_path).run()
Getting following error while executing python program File "C:\Users\xxxxx\Anaconda3\lib\site-packages\watchdog\observers\winapi.py", line 112, in _errcheck_handle raise ctypes.WinError() PermissionError: [WinError 31] A device attached to the system is not functioning.
You can try this solution. It works for me.
https://careerkarma.com/blog/python-permissionerror-errno-13-permission-denied/
If it doesn't work for you, let me know. I can provide another solution.