#NEWLINE# def run( self , file , globals = None , locals = None ) : #NEWLINE# #INDENT# if ( globals is None ) : #NEWLINE# #INDENT# sys . modules [ 'pydevd' ] = sys . modules [ '__main__' ] #NEWLINE# sys . modules [ 'pydevd' ] . __name__ = 'pydevd' #NEWLINE# from imp import new_module #NEWLINE# m = new_module ( '__main__' ) #NEWLINE# sys . modules [ '__main__' ] = m #NEWLINE# m . __file__ = encoding #NEWLINE# globals = m . __dict__ #NEWLINE# #UNINDENT# if ( locals is None ) : #NEWLINE# #INDENT# locals = globals #NEWLINE# #UNINDENT# if m . __file__ . startswith ( sys . path [ 0 ] ) : #NEWLINE# #INDENT# del sys . path [ 0 ] #NEWLINE# #UNINDENT# sys . path . insert ( 0 , os . path . split ( file ) [ 0 ] ) #NEWLINE# net = NetCommand ( str ( CMD_THREAD_CREATE ) , 0 , '<xml><thread name="pydevd.reader" id="-1"/></xml>' ) #NEWLINE# self . writer . addCommand ( net ) #NEWLINE# net = NetCommand ( str ( CMD_THREAD_CREATE ) , 0 , '<xml><thread name="pydevd.writer" id="-1"/></xml>' ) #NEWLINE# self . writer . addCommand ( net ) #NEWLINE# pydevd_tracing . SetTrace ( self . trace_dispatch ) #NEWLINE# try : #NEWLINE# #INDENT# threading . settrace ( self . trace_dispatch ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# thread . start_new_thread = pydev_start_new_thread #NEWLINE# thread . start_new = pydev_start_new_thread #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# while ( not self . readyToRun ) : #NEWLINE# #INDENT# time . sleep ( 0.1 ) #NEWLINE# #UNINDENT# PyDBCommandThread ( debugger ) . start ( ) #NEWLINE# if ( not IS_PY3K ) : #NEWLINE# #INDENT# execfile ( file , globals , locals ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stream = open ( file ) #NEWLINE# try : #NEWLINE# #INDENT# encoding = None #NEWLINE# for i in range ( 2 ) : #NEWLINE# #INDENT# line = stream . readline ( ) #NEWLINE# if line . strip ( ) . startswith ( '#' ) : #NEWLINE# #INDENT# if ( 'coding' in line ) : #NEWLINE# #INDENT# import re #NEWLINE# p = re . search ( 'coding[:=]\\s*([-\\w.]+)' , line ) #NEWLINE# if p : #NEWLINE# #INDENT# encoding = p . group ( 1 ) #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# finally : #NEWLINE# #INDENT# stream . close ( ) #NEWLINE# #UNINDENT# if encoding : #NEWLINE# #INDENT# stream = open ( file , encoding = encoding ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stream = open ( file ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# contents = stream . read ( ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# stream . close ( ) #NEWLINE# #UNINDENT# exec ( compile ( ( contents + '\n' ) , file , 'exec' ) , globals , locals )