What does "from the import module" mean?

And I literally mean not replacing "..". I saw this in the PySDL2-0.8.0 library:

from .. import sdlimage

The reason I'm asking myself is because I'm trying to run one of the examples they provided, and reading the trace leads me to a file that has this:

_HASPIL = True
try:
    from PIL import Image
except ImportError:
    _HASPIL = False

_HASSDLIMAGE = True
try:
    from .. import sdlimage
except ImportError:
    _HASSDLIMAGE = False

And of course, at some point in the same file:

if not _HASPIL and not _HASSDLIMAGE:
    raise UnsupportedError(load_image,
                           "cannot use PIL or SDL for image loading")

I don't have a PIL (python image library), but I have a sdlimage.py file. So, the file I'm trying to run is:

/Library/Python/2.7/site-packages/sdl2/examples/helloworld.py

Path to sdlimage.py:

/Library/Python/2.7/site-packages/sdl2/sdlimage.py

And the file that throws UnsupportedError (load_image, "cannot use PIL or SDL to load the image"):

/Library/Python/2.7/site-packages/sdl2/ext/image.py

I think there is something suspicious about this import ... Any ideas?

+3
source share

All Articles