Allen.Kan Allen.Kan - 3 months ago 5
Python Question

How to keep update the files using PYTHON

import os
import glob
import CameraID
files = glob.glob('/tmp/image/*.png')
count = 1
while (count==1):
for image in files:
if ( not os.path.isfile(image)):
print("Error: %s file not found" %image)
else:
print("Sending file %s ..." % image)
print CameraID.run()
print os.remove(image)


When I put the while loop, it will keep run and look for the old file instead the latest file. Anybody can help?

YFP YFP
Answer

moves the line:

files = glob.glob('/tmp/image/*.png')

into the while loop to keep that updated

Comments