Every line of 'python change working directory' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
17 def _change_cwd(target_dir): 18 cd_to_work = True 19 try: 20 cwd = os.getcwd() 21 except OSError: 22 cwd = recipe_dir or work_dir 23 os.chdir(target_dir) 24 # this is very important - or else if versioneer or otherwise is in the start folder, 25 # things will pick up the wrong versioneer/whatever! 26 sys.path.insert(0, target_dir) 27 return cd_to_work, cwd
23 def chdir(module): 24 os.chdir(os.path.dirname(module.__file__))