Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Created May 7, 2015 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CodyKochmann/263875a53f0615f23b01 to your computer and use it in GitHub Desktop.
Save CodyKochmann/263875a53f0615f23b01 to your computer and use it in GitHub Desktop.
Python snippet to get the full path of the script containing the snippet. (good for finding differently positioned workspaces)
def script_path(include_name=False):
# returns the full path of the script containing this snippet
# by: Cody Kochmann
from os import path
full_path = path.realpath(__file__)
if include_name:
return(full_path)
else:
full_path = "/".join( full_path.split("/")[0:-1] ) + "/"
return(full_path)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment