Array

Obtaining and Installing the Python Standard Library

Must Read

Adjusting to Life After Your Mortgage Is Fully Paid Off

Suddenly, after 25 years, less if you are lucky or more if you are not so lucky, you are...

Using the range() Function

The range() function is one of the more interesting functions when it comes to arrays because you can use...

Debt Consolidation Loans – Pillars of Hope

There is an old saying in the United States that goes something like this; roll with the punches. That...
Admin
test

You can obtain the Python Standard Library from a number of sources, but the best place to go is directly to the Python Web site at http://www.python.org/download/. Download the Python 2.6.4 Windows installer version of the product (about 14.2 MB). IronPython won’t currently work with the newer 3.1.1 version of Python (nor will many third-party libraries). After you complete the download, you’ll have a file named python-2.6.4.msi. The following steps tell how to install the product on your machine.

  1. Right-click the file and choose Install from the context menu. You’ll see a Welcome page like the one shown in Figure 6-1 that asks whether you want to install Python for all users or just for your own needs. Notice that you can’t perform a personal installation on Windows Vista — it really doesn’t work.
  2. Choose an installation option (either will work for the book) and click Next. The installer will ask where you want to install Python. In most cases, the installer will choose C:Python26, which works out well for using the Standard Library from IronPython. As an alternative, you could install Python in a directory below the IronPython directory, but the default usually works fine.

    Figure 6-1: Tell the installer whether you want a personal install or one for everyone.
    Figure 6-1: Tell the installer whether you want a personal install or one for everyone.

     

  3. Choose an installation location and click Next. You’ll see the Customize Python 2.6.4 dialog box shown in Figure 6-2. Notice the Register Extensions entry. If you let the installer make this change, Python, not IronPython, will be the default installation.

    Figure 6-2: Customize the Python installation to meet your needs.
    Figure 6-2: Customize the Python installation to meet your needs.
  4. Click the down arrow in the Register Extensions option and choose Entire Feature Will Be Unavailable from the menu. You can choose to keep all of the remaining features if desired (highly recommended).
  5. Configure any of the other installation options as needed. Click Next. You’ll see a status dialog box as Python installs to your hard drive. Eventually, you see a completion dialog box.
  6. Click Finish. Python (and its associated Standard Library) is set up on your machine.

C Modules in the Python Standard Library

One of the reasons that IronPython installs a tuned version of the Standard Library is that the full Standard Library has modules written in C included with it. These modules generally won’t work with IronPython. As Python has become more advanced, the developers have removed many of these C modules and you may eventually find that they’re all gone.

Of course, you might find that you really do need that C module because nothing else will work. In this case, you can try to gain access to the C module using IronClad (http://code.google.com/p/ironclad/). You won’t always have complete success using IronClad, but it does help considerably, and you should give it a try for those stubborn modules.

Another potential fix is getting a pure Python version of the module you need from PyPy (http://codespeak.net/pypy/dist/pypy/doc/). In many cases, the PyPy solution is actually a little more compatible than other solutions because it does rely on pure Python code to provide access to the module you want. A potential disadvantage of this solution is that the pure Python alternatives will tend to run slower than the C modules they replace.

Finally, there’s the IronPython Community Edition (also known as FePy) (http:// fepy.sourceforge.net/). This group has created solutions for the C modules based on the .NET Framework. From an IronPython perspective, this solution is probably the most compatible option. However, in using the .NET Framework, you potentially give up some cross-platform independence. Fortunately, the IronPython Community Edition also has information on using its version of IronPython with Mono (http://mono-project.com/Main_Page), which lets .NET applications run on both Linux and Macintosh systems.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest News

Top 10 Provinces of Thailand Not to be missed for Travel

10 SuratthaniThe source of the proverbial Chaiya salted egg. Surat Thani is a province with many attractions,...

Underlight As Accent, For Power and The Main Light for Photography

Underlighting, in which fill or accent light comes from under the topic, is not widely used technique in the traditional Portraits, even though it will have...

How To Fix Overexposure As A Creative Tool, The Complete Guide

As an creative tool, overexposure is sort of underrated. What I’m close to propose could be a deliberate and well thought out technique for...

7D Mark II is Canon’s best DSLR cameras without full-frame sensor.

The expected long-awaited Canon EOS 7D Mark II are shipping in November for $ 1,799 without a lens. With a higher price tag, you...

Low key photography and How to isolate your subject.

Low key photography doesn’t depend on underexposure to make its point; the key to low key is that the majority of tones, even correctly...

More Articles Like This