strange import error with Python-2.4.1

Robin Becker robin at reportlab.com
Tue Oct 11 06:07:27 EDT 2005


Whilst testing the excellent xlrd http://www.python.org/pypi/xlrd/0.3a1
I came across the following strangeness when trying to add an import of os to 
assist with debugging/tracing.


At line 66 I replaced

import sys

with import sys, os

and then ran python runxlrd.py --help and got this error which is not a real 
syntax problem

Traceback (most recent call last):
   File "runxlrd.py", line 5, in ?
     import xlrd
   File "C:\python24\lib\site-packages\xlrd\__init__.py", line 552
         if DEBUG: print >> self.logfile, "SST Processing"

if I remove the , os then the run produces the expected

usage: runxlrd.py [options] command input-file-patterns

options:
   -h, --help            show this help message and exit
   -l LOGFILENAME, --logfilename=LOGFILENAME
                         contains error messages
   -v VERBOSITY, --verbosity=VERBOSITY
                         level of information and diagnostics provided

I also am able to change the line to

import sys
import os

without error.

This behaviour doesn't occur with 2.4.2 or 2.4 only with 2.4.1. I looked for 
some bug fix in the recently released 2.4.2 that related, but couldn't find 
anything obvious. My system doesn't have psyco so xlrd's attempted psyco use 
shouldn't be an issue. Thanks for 2.4.2, but is this one of the fixed bugs or 
has it just got harder to induce?
-- 
Robin Becker




More information about the Python-list mailing list