python "import media" didn't work but there was "media.py"
Question: I read a book to learn python programming, it showed the code :

    
    
    import media
    

So I downloaded `gwpy-code.zip` from the link
<http://pragprog.com/titles/gwpy/source_code> and installed
`PyGraphics-2.0.win32.exe` . In the path `C:\Python27\Lib\site-
packages\pygraphics` there really was `media.py` ! But why `import media`
didn't work ? (ps: I also tried this `C:\Python27\Scripts\easy_install nose`
in the DOS box, still not work...) Best Regards :)


Answer: Try:

    
    
    from pygraphics import media
    

If you're not familiar with importing modules in Python yet, a brief
[primer](http://docs.python.org/reference/simple_stmts.html#grammar-token-
import_stmt) might be useful.

    
    
    >>> import sys
    >>> print sys.path
    

If you try the code above, you will see a bunch of directories on your system
path. `C:\Python27\Lib\site-packages\` should be one of these.

To import a file located on your system path, you can use `import filename`
(for filename.py). If the file lies in a subdirectory, e.g.
`dir1/dir2/filename.py`, it can be imported using `import dir1.dir2.filename`.

Note: A directory acts as a 'package' if it contains a file called
`__init__.py`. A file that can be imported is called a 'module'.

