Problem with inspect.getfile

elventear elventear at gmail.com
Wed May 2 01:53:55 EDT 2007


Found the offending code. I was importing between files that were at
the same level of the hierarchy without using absolute references.
Coded worked fine, but inspect didn't. Was this gaffe on my part? Or
was inspect supposed to handle it?

Thanks!

On May 1, 12:48 pm, elventear <elvent... at gmail.com> wrote:
> Hello,
>
> I am trying to use someone else's module that makes use of
> inspect.getsourcelines. The code was not working for me, so I have
> been debugging to see why it is not working. I have reduced my problem
> to getting the wrong file path in the getfile->return
> object.co_filename call.
>
> Basically the path I get is:
>
> "/Users/elventear/Documents/UTMEM/Projects/geotools/parsers/parser.py"
>
> When the correct path should be:
>
> "/Users/elventear/Documents/UTMEM/Projects/packages/geotools/parsers/
> parser.py"
>
> Finally my PYTHONPATH contains:
>
> "/Users/elventear/Documents/UTMEM/Projects/packages"
>
> So basically, I am able to resolve correctly the package from withing
> Python, I don't know why there is this confusion about the filename
> that contains my objects and methods.
>
> Any ideas on how to correct this would be appreciated.
>
> This is under MacOSX 10.4.9, Python 2.5 (Build from Fink).
>
> Thanks!





More information about the Python-list mailing list