#NEWLINE# def main( argv ) : #NEWLINE# #INDENT# if ( len ( argv ) < 2 ) : #NEWLINE# #INDENT# sys . stderr . write ( ( 'Syntax: %s [python module or file]\n\nNote: using .py suffix simplifies your code and allows skipping the boilerplate\nheader, e.g., "from resources import *" but uses compile() + eval().\n\nSkipping the .py suffix causes the file to be treated as a Python modile which\nrequires adding the import line manually and will use __import__() as the\nmechanism.\n' % argv [ 0 ] ) ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# path = argv [ 1 ] #NEWLINE# if path . endswith ( '.py' ) : #NEWLINE# #INDENT# resources = CompileAndEvalFile ( path ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# resources = ImportModule ( path ) #NEWLINE# #UNINDENT# print ( ( '%s' % json . dumps ( resources , indent = 2 , separators = ( ',' , ': ' ) , sort_keys = True ) ) )