我正在尝试使用sub将csv文件插入mysql表进程调用我不知道哪里出错了,我检查了我的文件,一切都很好。在def ringoCallback3(filename):
#Run the RINGO insert script
tmp = filename.split('/')
just_filename = tmp[-1]
new_filename = "/home/toor/doneringofiles/%s" % just_filename
retval = subprocess.call(["/usr/local/bin/ringo.py",filename])
os.rename(filename, new_filename)
return retval
dirlist = [ ['/home/toor/ringolist',ringoCallback3]]
while (True):
# Go through each of the directories
for mylist in dirlist:
check_dir = mylist[0]
callback = mylist[1]
# get the list of files in the directory
filelist = os.listdir(check_dir)
for this_file in filelist:
if ((this_file == ".") or (this_file == "..") or (this_file == "doneringofiles")):
print "Skipping self and parent"
continue
full_filename = "%s/%s" % (check_dir, this_file)
# Get the modification time of the file
first_stat = os.stat(full_filename)[8]
# Sleep for 1 second
time.sleep(1)
# Get the modification time again
second_stat = os.stat(full_filename)[8]
# If the modication time has not changed, then the file is stable
# and can be sent to the callback
if (first_stat == second_stat):
callback(full_filename)
# Now sleep for 30 seconds before doing the whole lot again
time.sleep(30)
当我运行这个代码时:我得到这个错误:
^{pr2}$