My application runs fine in one computer but when I run the same application in another I get the error:
Traceback (most recent call last):
File "./th.py", line 98, in browse_file2
self.textEdit_2.append(str(os.path.basename(p)))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 121, in basename
i = p.rfind('/') + 1
AttributeError: 'QString' object has no attribute 'rfind'
I have seen a similar error here. According to this, I need to typecast parameter to 'QString' datatype and I am doing that.The part of script that is having error is:
def browse_file(self):
#files handling
caption="Open File"
directory='./'
filter_mask="fastq files (*.fastq)"
self.textEdit.setText("")
f_1=(QFileDialog.getOpenFileNames(None, caption, directory, filter_mask))
#for st in f_1:
for p in f_1:
self.textEdit.append(str(os.path.basename(p)))
global R1
R1=f_1
#if textEdit.toPlainText
def browse_file2(self):
#files handling
caption="Open File"
directory='./'
filter_mask="fastq files (*.fastq)"
f_2=(QFileDialog.getOpenFileNames(None, caption, directory, filter_mask))
for p in f_2:
self.textEdit_2.append(str(os.path.basename(p)))
global R2
R2=f_2
Can someone please tell what may be the possible cause of this error? Let me know if you need any other part of code. Thanks in advance.