Skip to content

Instantly share code, notes, and snippets.

@OmniZ3D
Created August 28, 2012 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save OmniZ3D/3495019 to your computer and use it in GitHub Desktop.
Save OmniZ3D/3495019 to your computer and use it in GitHub Desktop.
Select current python file in explorer
# Select current python file in explorer
import os, sys, subprocess, inspect
subprocess.Popen(r'explorer /select,%s' % os.path.abspath(inspect.getfile(inspect.currentframe())))
## or...
pFileName = os.path.abspath(inspect.getfile(inspect.currentframe()))
pFileDir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
print 'pFileName = %s\n' % pFileName
print 'pFileDir = %s' % pFileDir
subprocess.Popen(r'explorer /select,%s' % pFileName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment