Python - Wrong directory when execute from terminal -
if run ide dir path ok, when execute termianl, geeting exception:
code:
def __init__(self): dir = os.path.abspath(os.path.join(__file__, os.pardir)) self.locator_file_path = dir+'/locators/locator_'+self.get_class_name_lower()+'.json' open(self.locator_file_path) json_data:
exception:
e ====================================================================== error: test_verify_page (test_verify_page.testverifypage) ---------------------------------------------------------------------- traceback (most recent call last): file "test_verify_page.py", line 9, in test_verify_page sign_inpage = signinpage() file "c:\python27\lib\site-packages\page_objects\sign_in_page.py", line 47, in __init__ open(self.locator_file_path) json_data: ioerror: [errno 2] no such file or directory: 'c:\\python27\\lib\\site-packages\\page_objects/locators/locator_signinpage.json' ---------------------------------------------------------------------- ran 1 test in 13.189s failed (errors=1)
the real path file placed is:
"c:\my_project\page_objects\locators\locator_signinpage.json'
i checked settings in python console , not able solve this.
Comments
Post a Comment