Add your questions here and we'll do our best to answer them.

/!\ If you subscribe to this page you will be notified when it changes. That way you can easily tell if/when your question has been answered.

But see also:

Win 95 Installation

Q. I run a Windows 95 200 MHz Compaq computer, when I tried to install Python 2.0, the installation program consistently crashes/freezes at 52% of the process. Can you give me any suggestions?

A. Make sure you have enough disk space. Accept the default choices the installer suggests. Make sure all other programs are killed first, especially virus scanners (use Ctrl+Alt+Del repeatedly to kill off everything except Explorer and Systray). Try a more recent version of Python (like 2.2.1), which uses better installer technology. Try an ActiveState installer, which uses completely different installer technology. Try the minimalist PythonWare installer, which seems to amount to an automated unzip. Accept that Microsoft no longer supports Win95 and plan to get another OS.

pyexpat Module

Q. I just downloaded version 2.0. When I try to run the module it complains that it can't find the driver I looked in the distribution and it doesn't seem to be there? I'm running on Solaris 2.7. Thank You.

A. The pyexpat module is a compiled extension module. See the comments in the Modules/Setup file for instructions on getting and building the required C library. Once you've built that, enable the module in the Modules/Setup file and type "make" in the top level of the Python source tree. "make --install" will re-install Python for you, or you can copy Modules/ to $exec_prefix/lib/python2.0/lib-dynload/ if you're building modules as shared objects.

Documentation in Windows Helpfile Format

Q. Where do I get the documentation for Python in the CHM (Compiled HTML) format?

A. See

A. Since version 2.3 included in Windows distribution.

Windows XP look-and-feel

Q. How can I make WxPython on Windows XP assume XP look-and-feel?

A. Put two files python.exe.manifest and pythonw.exe.manifest, both with the following contents:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="" processorArchitecture="X86" name="*.*.*" type="win32" />
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls"
 version="" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" />

in your Python installation directory (where respective .exe files reside). Next time you run your wxPython applications, they'll look like "normal" XP applications.

This may also affect other Python modules that use Windows display API.

Missing Readline Module

I have problem when i first install Python 2.4. It seems that the distribution lack

It's possible that the readline module is a separate package in your SUSE Linux distribution.

-Do not type if you do not know. I compiled Python 2.4.4 from source ./configure --enable-readline make make install and I get this error.

How to Access Tomcat from Python

Looking for examples of accessing Tomcat applications from Python.

I will be looking myself, and will post what I learn here, but so far Tomcat applications that require authentication are giving my python applications a 401 no matter what I try.

The Following Does Not Work

import urllib2

myUrl = 'http://localhost:8080/manager/html'
username = 'root'
password = 'r00t4me'

req = urllib2.Request(myUrl)

base64string = ('%s:%s' % (username, password)).encode('base64')[:-1]
authheader =  "Basic %s" % base64string
req.add_header("Authorization", authheader)

    f = urllib2.urlopen( myUrl )
except urllib2.HTTPError, e:
    if e.code == 401:
        print 'not authorized'
    elif e.code == 404:
        print 'not found'
    elif e.code == 503:
        print 'service unavailable'
        print 'unknown error: '
    print 'success'
    for line in f:
        print line,

This yields a 401 'not authorized' when it should not, i.e. the username and password are correct. This is to connect to the page for the Tomcat manager application as a test, not to do any real work.

Python Object ID

You can get a unique ID number for any object:

   1 >>> x="hello"
   2 >>> id( x )
   3 10855264
   4 >>> 

...but how do you get from the object ID, back to the object itself?

What can I do to take 10855264, in this case, and see if I can get back "hello"?

Or is that not possible, without making a dictionary to hold it?

   1 >>> x="hello"
   2 >>> d={}
   3 >>> d[id(x)]=x
   4 >>> d
   5 {10855264: 'hello'}
   6 >>>

Contributors: SteveHolden, FredrikLundh, JohannesGijsbers, SkipMontanaro


PythonQuestions (last edited 2009-12-24 06:01:33 by adsl-71-141-106-3)

Unable to edit the page? See the FrontPage for instructions.