Problem with inspect.getfile

elventear elventear at gmail.com
Wed May 2 10:46:29 EDT 2007


On May 2, 1:12 am, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Wed, 02 May 2007 02:53:55 -0300, elventear <elvent... at gmail.com>  
> escribió:
>
> > 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?
>
> Could you provide an example?

Simple example

My PYTHONPATH points to /python

I have the following:

/python/packages
    __init.py__
    /containers
        __init.py__
        module1.py
        module2.py

So basically module2 depends on module1. So within module2.py I was I
was doing "import module1" instead of import
"packages.containers.module1". My code ran ok, but the functions in
the inspect module weren't able to handle it (getfile was the source
of the problem).

Thanks.




More information about the Python-list mailing list