#NEWLINE# @ click . command ( short_help = 'Open a data file and start an interpreter.' ) #NEWLINE# @ options . file_in_arg #NEWLINE# @ click . option ( '--ipython' , 'interpreter' , flag_value = 'ipython' , help = 'Use IPython as interpreter.' ) #NEWLINE# @ click . option ( '-m' , '--mode' , type = click . Choice ( [ 'r' , 'r+' ] ) , default = 'r' , help = "File mode (default 'r')." ) #NEWLINE# @ click . pass_context #NEWLINE# def insp( ctx , input , mode , interpreter ) : #NEWLINE# #INDENT# ' Open the input file in a Python interpreter.\n    ' #NEWLINE# verbosity = ( ( ctx . obj and ctx . obj . get ( 'verbosity' ) ) or 1 ) #NEWLINE# logger = logging . getLogger ( 'rio' ) #NEWLINE# try : #NEWLINE# #INDENT# with Env ( CPL_DEBUG = ( verbosity > 2 ) ) as env : #NEWLINE# #INDENT# with rasterio . open ( input , mode ) as src : #NEWLINE# #INDENT# main ( ( 'Rasterio %s Interactive Inspector (Python %s)\nType "src.meta", "src.read(1)", or "help(src)" for more information.' % ( rasterio . __version__ , '.' . join ( map ( str , sys . version_info [ : 3 ] ) ) ) ) , src , src ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# logger . exception ( 'Exception caught during processing' ) #NEWLINE# raise click . Abort ( )