0
我使用PyQt4並無法打開文本文件,並將其顯示到Qtextedit。 「打印F +」這需要在文本編輯去」,它的存在,但開說,這不是任何幫助,將不勝感激版畫PYQT和讀取文件到Qtextedit
def convertDirectory(self):
directoryPath = self.selectFilecsvtoxml()
cmd = ('python loginformationExtractor.py '
+str(directoryPath))
print cmd + " this is executable command"
os.system(cmd)
for file_name in os.listdir(directoryPath):
print (directoryPath) + "****" + file_name
if file_name.endswith(".txt"):
f = file_name
print f + " this needs to go in textedit"
readMe = open(f,'r').read()
self.textEdit.setText(readMe)
我的錯誤/打印輸出:。
/Users/eeamesX/work/data/releaseOct27****UUIDreadout.txt
UUIDreadout.txt this needs to go in textedit
Traceback (most recent call last):
File "/Users/eeamesX/PycharmProjects/Workmain/windows.py", line 2792, in convertDirectory
readMe = open(f,'r').read()
IOError: [Errno 2] No such file or directory: 'UUIDreadout.txt'
嘗試和努力,謝謝! – Anekdotin