Python os._exists() Examples
The following are 5
code examples of os._exists().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
os
, or try the search function
.
Example #1
Source File: test_instences.py From jdit with Apache License 2.0 | 6 votes |
def tearDown(self): dir = "log_debug/" if os._exists(dir): shutil.rmtree(dir)
Example #2
Source File: test_instences.py From jdit with Apache License 2.0 | 4 votes |
def setUp(self): dir = "log_debug/" if os._exists(dir): shutil.rmtree(dir)
Example #3
Source File: test_supParallelTrainer.py From jdit with Apache License 2.0 | 4 votes |
def tearDown(self): logdir = "log_debug/" if os._exists(logdir): shutil.rmtree(logdir)
Example #4
Source File: test_supParallelTrainer.py From jdit with Apache License 2.0 | 4 votes |
def setUp(self): logdir = "log_debug/" if os._exists(logdir): shutil.rmtree(logdir) unfixed_params = [{'task_id': 2, 'depth': 1, 'gpu_ids_abs': []}, {'task_id': 1, 'depth': 2, 'gpu_ids_abs': [1, 2]}, {'task_id': 1, 'depth': 3, 'gpu_ids_abs': [1, 2]}, {'task_id': 2, 'depth': 4, 'gpu_ids_abs': [3, 4]} ]
Example #5
Source File: test_auth.py From hack12306 with MIT License | 3 votes |
def test_loin_qr(): try: train_auth_api = TrainAuthAPI() cookie_dict = train_auth_api.auth_init() result = train_auth_api.auth_qr_get(cookies=cookie_dict) assert isinstance(result, dict) qr_uuid = result['uuid'] print 'qr uuid. %s' % qr_uuid qr_img_path = '/tmp/12306/login-qr-%s.jpeg' % uuid.uuid1().hex if not os.path.exists(os.path.dirname(qr_img_path)): os.makedirs(os.path.dirname(qr_img_path)) with open(qr_img_path, 'wb') as f: f.write(base64.b64decode(result['image'])) im = Image.open(qr_img_path) im.show() for _ in range(6): qr_check_result = train_auth_api.auth_qr_check(qr_uuid, cookies=cookie_dict) print 'check qr result. %s' % json.dumps(qr_check_result, ensure_ascii=False) if qr_check_result['result_code'] == "2": print 'qr check success result. %s' % json.dumps(qr_check_result, ensure_ascii=False) break time.sleep(3) else: print 'scan qr login error and exit.' os._exists(-1) uamtk_result = train_auth_api.auth_uamtk(qr_check_result['uamtk'], cookies=cookie_dict) print 'uamtk result. %s' % json.dumps(uamtk_result, ensure_ascii=False) uamauth_result = train_auth_api.auth_uamauth(uamtk_result['newapptk'], cookies=cookie_dict) print 'uamauth result. %s' % json.dumps(uamauth_result, ensure_ascii=False) cookies = { 'tk': uamauth_result['apptk'] } cookies.update(**cookie_dict) user_info_result = TrainUserAPI().user_info(cookies=cookies) print '%s login successfully.' % user_info_result['name'] print 'cookies. %s' % json.dumps(cookies, ensure_ascii=False,) finally: if os.path.exists(qr_img_path): os.remove(qr_img_path)