Skip to content

Instantly share code, notes, and snippets.

@defunkt
Forked from mmalone/vipy.sh
Created March 3, 2010 04:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save defunkt/320305 to your computer and use it in GitHub Desktop.
Save defunkt/320305 to your computer and use it in GitHub Desktop.
Simple shell script that locates a Python module and opens it in vi.
#!/bin/bash
if [ $# -ne 1 ]; then
echo "Usage: vipy <python module>"
exit 1
fi
MODULE_LOCATION=`python -c "import $1; print $1.__file__.rstrip('c')"`
if [ -z $MODULE_LOCATION ]; then
echo "Couldn't find module: $1"
exit 1
fi
vi $MODULE_LOCATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment