Skip to content

Instantly share code, notes, and snippets.

@joezuntz
Created November 28, 2013 11:45
Show Gist options
  • Save joezuntz/7690640 to your computer and use it in GitHub Desktop.
Save joezuntz/7690640 to your computer and use it in GitHub Desktop.
Short script to open a named python module in your EDITOR
#!/usr/bin/env python
import sys
import imp
import os
def edit_module(module_name):
path = imp.find_module(module_name)[1]
editor = os.environ.get("EDITOR", "emacs -nw")
cmd = "{0} {1}".format(editor, path)
os.system(cmd)
if __name__=="__main__":
module_name = sys.argv[1]
edit_module(module_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment