Created
          November 28, 2013 11:45 
        
      - 
      
- 
        Save joezuntz/7690640 to your computer and use it in GitHub Desktop. 
    Short script to open a named python module in your EDITOR
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/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