10 examples of 'get current directory python' in Python

Every line of 'get current directory python' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
71def get_directory():
72 return os.path.abspath(os.path.join(os.getcwd(), 'python'))
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

705def get_current_path( self ):
706 if self.CGIdata.has_key( "path" ):
707 relativ_path = posixpath.normpath( self.CGIdata["path"] )
708 else:
709 relativ_path = "."
710
711 cfg.base_path = posixpath.normpath( cfg.base_path )
712
713 absolute_path = posixpath.join( self.absolute_basepath, relativ_path )
714 absolute_path = posixpath.normpath( absolute_path )
715
716 self.check_absolute_path( absolute_path )
717
718 return relativ_path, absolute_path
1447def get_current_dir(self):
1448 """Gets the working directory of the current tab to create a
1449 new one in the same dir.
1450 """
1451 active_terminal = self.notebook.get_current_terminal()
1452 directory = os.path.expanduser('~')
1453 if active_terminal:
1454 active_pid = active_terminal.get_pid()
1455 if active_pid:
1456 cwd = os.readlink("/proc/{0}/cwd".format(active_pid))
1457 if os.path.exists(cwd):
1458 directory = cwd
1459 return directory
24def getCurrentDir(self):
25 """returns the script directory name to locate the correct dictionary path"""
26 return os.path.dirname(os.path.abspath(__file__)) + '/';
283def getcwd():
284 """
285 Wrap os.getcwd()
286
287 On Windows return ShortPathName (8.3 filename) that contain only ascii
288 characters.
289 """
290 cwd = os.getcwd()
291 # TODO os.getcwd should work properly with py3 on windows.
292 if is_win:
293 try:
294 unicode(cwd)
295 except UnicodeDecodeError:
296 # Do conversion to ShortPathName really only in case 'cwd' is not
297 # ascii only - conversion to unicode type cause this unicode error.
298 try:
299 import win32api
300 cwd = win32api.GetShortPathName(cwd)
301 except ImportError:
302 pass
303 return cwd
35@property
36def current(self):
37 return self._cwd
587def get_curdir(self):
588 try:
589 return self.curdir_
590 except AttributeError:
591 self.curdir_ = os.getcwd()
592 return self.get_curdir()
154def get_curdir(self):
155 return self.path.abspath()
655def getcwd():
656 """
657 Wrap os.getcwd()
658
659 On Windows return ShortPathName (8.3 filename) that contain only ascii
660 characters.
661 """
662 cwd = os.getcwd()
663 # os.getcwd works properly with Python 3 on Windows.
664 # We need this workaround only for Python 2 on Windows.
665 if is_win and is_py2:
666 try:
667 unicode(cwd)
668 except UnicodeDecodeError:
669 # Do conversion to ShortPathName really only in case 'cwd' is not
670 # ascii only - conversion to unicode type cause this unicode error.
671 try:
672 cwd = win32api.GetShortPathName(cwd)
673 except ImportError:
674 pass
675 return cwd
102def DirectoryOfThisScript():
103 return os.path.dirname(os.path.abspath(__file__))

Related snippets