0
我有一個python腳本,看起來像這樣:正在同步通過Dropbox的文件的HDF5,因爲它是被寫入
#!/usr/bin/env python3
import tables as pt
import numpy as np
import time
class TestTable(pt.IsDescription):
timestamp = pt.Float64Col()
voltage = pt.Float32Col()
h5file = pt.open_file('does_it_update_dropbox.h5', mode='a')
if not h5file.__contains__('/test'):
h5file.create_table('/', 'test', TestTable)
row = h5file.root.test.row
try:
while True:
time.sleep(10)
for _ in range(1000):
row['timestamp'] = time.time()
row['voltage'] = np.random.random(1)[0]
row.append()
h5file.root.test.flush()
print('1000 records added')
except:
pass
h5file.close()
每隔10秒,寫入數據到HDF5文件。比方說,我有一臺計算機在實驗室裏過夜收集傳感器的數據,我想分析一下我家5英里外的數據。事實證明,如果這是在Dropbox監視的文件夾中,那麼一旦腳本完成(例如,如果我給它一個鍵盤中斷),Dropbox只會同步。我發現如果我在Unix機器上運行touch does_it_update_dropbox.h5
,我可以使Dropbox同步。但是,我實驗室的機器是Windows。
堆棧溢出,我如何通過Dropbox將HDF5文件同步寫入Windows計算機中進行同步?
如果你需要的是「觸摸」的窗口,看看這個https://stackoverflow.com/questions/30011267/windows-equivalent-of-touch-ie-the-node-js-寫一個小的Python腳本,比如'open(「does_it_update_dropbox.h5」,「ab」)。write(「」) – Pablo