サーバーでボットを検索して削除する新しいセクションをプログラムに追加しようとしていますが、プログラムが2番目の部分に到達するたびに、ショーを停止する問題が発生します(追加したもの) 「readFirst」の出力は「[]」です。次の数行を実行すると、明らかな理由で「リスト インデックスが範囲外です」というエラーが表示されます。
readlines 変数はプログラムの両方の部分で共有されるべきではないため、なぜこれが起こっているのかわかりません。
コードは次のとおりです。
while runTimes >= 0:
#Cycles through .php files
openedProg = glob.glob('*.php')
openedProg = openedProg[currentPhp:currentPhp+1]
progInput = ''.join(openedProg)
if progInput != '':
theBot = open(progInput,'r')
#Singles out "$output" on this particular line and closes the process
readFourthFromBottom = theBot.readlines()
wholeLine = (readFourthFromBottom[-4])
output = wholeLine[4:11]
#Singles out "set_time_limit(0)"
readFirst = theBot.readlines()
print(readFirst)
wholeLine2 = (readFirst[0])
output2 = wholeLine2[7:24]
print(output2)
theBot.close()
if progInput == '':
currentPhp = -1