small medium large xlarge

05 Jul 2009, 19:57
Mike Huffman (3 posts)

I cannot get the Chapter 4 media module examples to work with Python 2.6(.2) on Windows (XP, Vista). I used PyGraphics-2.0.win32.exe from the install directory in the book’s code file ( and followed the instructions in that directory. Wing IDE, PIL, pygame, and numpy installation files: *wingide-101-3.1.8-1.exe *PIL-1.1.6.win32-py2.6.exe *pygame-1.8.1release.win32-py2.6.msi *numpy-1.3.0-win32-superpack-python2.6.exe

The examples work as expected with Python 2.5 and applicable versions of PIL, pygame, and numpy.

Specifically, raises a Tkinter exception. Using media.show_external() works, but only after setting the environment TEMP variable to the current directory. Finally, the cropping exercise does not actually crop the image, although get_width() and get_height() return the new values.

Has anyone else experienced anything similar, or have I missed an obvious step somewhere? I notice that the pygame download pages says “(python2.5.4 is the best python on windows at the moment)” and wonder if that has something to with the problems…

Oh, and by the way, ‘pic207.jpg’ is not in the code collection of files, although easy enough to create from the PDF version of the book.


10 Jul 2009, 22:43
Mike Huffman (3 posts)

Here is the answer:

“If you want to use the image manipulation examples from the book, you should use Python 2.5 because some of the libraries that our code relies on have not yet been updated to work with Python 2.6.” Practical Programming: installation instructions


11 Jul 2009, 14:38
Paul Gries (46 posts)

Hi Mike,

This is Paul, one of the authors. Your initial post prompted us to take a close look; we’ve had some success with Python 2.6 on Windows XP but not on Vista or 7 and some difficulties on Mac OS X, and the whole dependency mess made us update the instructions to focus on Python 2.5. Our apologies for the bad instructions in the first place.

13 Sep 2010, 21:16
Joseph Crawford (19 posts)

I just bought this book and on Mac OSX it comes with 2.6.1 on Snow Leopard. I tried to download the python-2.5-macosx.dmg and installed the MacPython.mpkg but it still did not override the 2.6.1 version. I installed all of the packages from your Install Instructions however when I am in iPython this is what I get

In [1]: import media

ImportError Traceback (most recent call last)

/Users/jocrawfo/Downloads/Python-2.5.5/ in ()

ImportError: No module named media

Is this book really that out dated already?

06 Sep 2011, 14:43
Josh Starliper (1 post)

I’m running Python2.5 on Win7 64-bit. After installing all of the packages suggested by the “index.html” in the downloaded book source code, I get this message when trying to import media:

import media Traceback (most recent call last): File “C:\Program Files (x86)\Wing IDE 101 4.0\src\debug\”, line 1, in # Used internally for debug sandbox under external interpreter File "C:\Python25\Lib\site-packages\pygraphics\", line 13, in from sound import * File "C:\Python25\Lib\site-packages\pygraphics\", line 12, in import numpy File "C:\Python25\Lib\site-packages\numpy\", line 130, in import add_newdocs File "C:\Python25\Lib\site-packages\numpy\", line 9, in from lib import add_newdoc File "C:\Python25\Lib\site-packages\numpy\lib\", line 4, in from type_check import * File "C:\Python25\Lib\site-packages\numpy\lib\", line 8, in import numpy.core.numeric as _nx File "C:\Python25\Lib\site-packages\numpy\core\", line 5, in import multiarray ImportError: DLL load failed with error code 193

What does this mean and how can I fix this? Thanks.


07 Sep 2011, 23:42
Paul Gries (46 posts)

I have two thoughts on this (and will generate more if neither pans out).

1) Are you using 32-bit or 64-bit Python? One of the supporting libraries seems to occasionally have trouble with 64-bit.

2) There is a new version of the media library, just released today! It works in Python 2.7. Here are the installation instructions:

Please let me know if these doesn’t solve your problem (or cause others).

17 Feb 2013, 20:36
Andy Craig (1 post)

Paul, I’m using your textbook for an introductory programing class I’m taking, and the link you post above (which is also in the book, page 46) doesn’t work. I get a 503 error. So I can’t proceed with my homework because I can’t load the media module. Can you please provide an updated link to a Windows 64-bit version of PyGraphics?



You must be logged in to comment