[maya][python]scriptEditorInfoでスクリプトエディタの内容のログの最後の行を取る

Take the last line of the log in the contents of the script editor

#!/usr/bin/env python
# -*- coding: utf-8 -*-
workSpaceDir=cmds.workspace( q=True, rootDirectory=True )
print("workSpaceDir= "+workSpaceDir)
historyFilename=workSpaceDir+'scriptEditorInfo_tempHistoryLog7.txt'
print("historyFilename= "+historyFilename)
cmds.scriptEditorInfo(input="")
cmds.scriptEditorInfo( historyFilename=historyFilename, writeHistory=True )

print("----startLog00700---")
#-----この間にUSD prim を選択させてみたい。 ----------
#------難しいかな??
#-----この間にUSD prim を選択させてみたい。 ----------
import codecs
fin  = codecs.open(historyFilename, 'r', 'shift_jis')
lineCount=0
lineArr=[]
for line in fin:
    #print("lineNum:"+str(lineCount)+" lineStr:"+line)
    lineCount=lineCount+1
    lineArr.append(line)
#fout = codecs.open('sjis.txt', 'w', 'shift_jis')
#fin_str=str(fin)
lineArr_len=len(lineArr)
print("lineArr_len= "+str(lineArr_len))
LastLine_Str=lineArr[lineArr_len-1]
print("LastLine_Str= "+LastLine_Str)

cmds.scriptEditorInfo(input="")
cmds.scriptEditorInfo( historyFilename=historyFilename, writeHistory=False )

print("----NotLoged----")

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です