Presume I have a package 'a' like this:

   - /pystuff  (added to sys.path)
   - /a  (start of my package)
      - __init__.py
         - /b
            - __init__.py
            - module.py

to import module.py:
import *a.b.module*

What I'm trying to find is a way to query exactly what I typed above (in
bold):  Inside of module.py, can it query it's path back to the package
root?  Printing __file__ inside of module.py is close:
c:/pystuff/a/b/module.py

But I just want '*a.b.module'*
I can search sys.path for paths, remove them from __file__, switch slashes
to dots, strip extensions, etc.  But I've learned that there's usually
something easier in Python that I'm just missing.  I thought maybe the
inspect module, but I didn't have any luck there, nor did my Google queries.

thanks
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to