Thank you for your suggestions... I have tried a number of things to get this to work.
If the file path is hard coded, it appears to work correctly. If my script grabs the text from onscreen elements and puts them together (path + filename), it fails.
Here are the test cases that I have using :
Path text from on screen text elements (from JAVA GUI App) - Fails. Using Python Raw string. :
1) Check_File_Status :: File Status NOT Correct : |C:\\Users\\steven.reiss\\Documents\\"Compass for SW"\\Instrument_Reports\\Jess-js3019_2019-10-01_13-10.pdf| : False : should be True
2) Check_File_Status :: File Status NOT Correct : |C:\Users\steven.reiss\Documents\Compass for SW\Instrument_Reports\Jess-js3019_2019-10-01_13-11.pdf| : False : should be True
Hard-Coded path - Works correctly
1)
def Test1():
the_file = 'C:\\Users\\steven.reiss\\Documents\\Compass for SW\\Instrument_Reports\\Jess-js3003_2019-10-01_11-24.pdf'
val = aqObject.GetVarType(the_file)
status = CommonUnit.Check_File_Exists(the_file, True)
Log.Message("file status = %s %s" % (status, val))
Result : file status = True 8 (varOleStr)
2)
def testFileinFolder():
# file_path_name = r'C:\Users\sathishkumark\Desktop\Folder with space\report.pdf'
file_path_name = r'C:\Users\steven.reiss\Documents\Compass for SW\Instrument_Reports\Jess-js3003_2019-10-01_11-24.pdf'
file_status = aqFile.Exists(file_path_name)
Log.Message(aqObject.GetVarType(file_path_name))
if file_status is True:
Log.Checkpoint('File is present under the path specified')
else:
Log.Error('File is Not present under the path specified')
status = CommonUnit.Check_File_Exists(file_path_name, True)
Log.Message("Status = %s" % status)
Result : Status = True
Are there any other things you can suggest??