Skip to content

Instantly share code, notes, and snippets.

@TimothyFitz
Last active December 15, 2015 10:59
Show Gist options
  • Save TimothyFitz/5250201 to your computer and use it in GitHub Desktop.
Save TimothyFitz/5250201 to your computer and use it in GitHub Desktop.
pysubl
#!/usr/bin/env python
import sys, os, os.path
sys.path.append('.')
# Weird hack, __import__("a.b.c") returns module a unless fromlist is non-empty, then it returns module c
filename = __import__(sys.argv[1], fromlist=["whatever"]).__file__
os.system('subl ' + os.path.dirname(filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment