ytrstu / winpdb

Automatically exported from code.google.com/p/winpdb
0 stars 0 forks source link

Function "calc_frame_path" doesn't compute the actual path of a file called with function "execfile" #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Module "rpdb2.py" contains a function named "calc_frame_path" computing the 
path of the file relative to a frame from special attribute "__file__".

But for a frame relative to a file executed with the "execfile" function, this 
"__file__" is equal to the path of the caller function. Consequently, I suggest 
to replace the following piece of code :

def calc_frame_path(frame) :
    globals_filename = frame.f_globals.get('__file__', None)
    ...

by :

...

import inspect

...

def calc_frame_path(frame) :
    globals_filename = os.path.join(os.getcwd(), inspect.getfile(frame))
    ...

Regards,

Thierry BRIZZI.

Original issue reported on code.google.com by thierry....@gmail.com on 31 Aug 2012 at 1:41