You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The below script was working previously on my Mac. Now the on_created event handler never fires. This same script works on my Ubuntu machine.
try:
base_path=os.environ['EVOLVE_HOME']
exceptKeyError:
print('Could not get environment variable "base_path". This is needed for the tests!"')
raisedefram_recorder(): # Thread to extract new data from RAM text files into CSV file with timestampclassRAMHandler(FileSystemEventHandler): # Watchdog folder monitor Classdefon_created(self, event): # When file is created in monitored folderglobalclient# Call global variables set outside of Classnew_ram=str(event.src_path) # Extract filepath from new file in monitored foldertime.sleep(.5)
line=linecache.getline(new_ram, 3)
r_base=os.path.basename(new_ram) # Strip filepath too base file namer_nano=int(r_base.strip('RAM_ .txt')) # Strip nanosecond time from file nameif"MemAvailable"inline:
mem=int(line.strip("MemAvailable: \n kB"))
body= [
{
"measurement": "Evolve",
"tags": {
"Software": version,
},
"time": r_nano,
"fields": {
"RAM": mem,
}
}
]
client.write_points(body)
returnr_nanor_observer=Observer()
r_event_handler=RAMHandler()
r_observer.schedule(r_event_handler, path=os.path.join(base_path, 'test'), recursive=False) # Folder to monitorr_observer.start()
I am running the following:
Python 3.9
Mac OS 11.0.1
Watchdog 0.10.4
The text was updated successfully, but these errors were encountered:
The below script was working previously on my Mac. Now the on_created event handler never fires. This same script works on my Ubuntu machine.
I am running the following:
The text was updated successfully, but these errors were encountered: