Cannot import opj

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri May 9 01:26:22 EDT 2008


En Thu, 08 May 2008 21:28:25 -0300, David Anderson <zerty.david at gmail.com>  
escribió:

> I'm trying to import the opj module

What's the opj module?

> Trying like this:
> from Main import opj
> It says it doesn't exists

And why do you think it should exist?

> And like this:
> import os.path.join as opj
> Raises error.
> What should I do?

os is a module, os.path is a module too, which contains a function named  
join. You can't import it that way. Try:

a) from os.path import join as opj
b) import os.path
    opj = os.path.join

You import modules (or packages) using "import xxx", or you import  
individual attributes from those modules or packages using "from xxx  
import yyy"

What are you really trying to do?

-- 
Gabriel Genellina




More information about the Python-list mailing list