Module name to filename and back?

R

Ron Adam

Is there a function to find a filename from a dotted module (or package) name
without importing it?

The imp function find_module() doesn't work with dotted file names. And it
looks like it may import the file as it raises an ImportError error exception if
it can't find the module. (Shouldn't it raise an IOError instead?)

What I'm looking for is to be able to get the full module name when I have a
filename. And get the full filename when I have the module name. And do both
of these without importing the module.

modulename <==> filename
filename <==> modulename

Ron
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top