Skip to content

Instantly share code, notes, and snippets.

Created December 5, 2012 21:44
Show Gist options
  • Save anonymous/4219779 to your computer and use it in GitHub Desktop.
Save anonymous/4219779 to your computer and use it in GitHub Desktop.
Open any python module in sublime, ie: pysubl django.contrib.auth
#!/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