Traceback (most recent call last): PROBLEM

smarras at bsc.es smarras at bsc.es
Fri Oct 12 14:59:51 CEST 2007


Hello everyone, I keep obtaining an error message whenever I execute some
very simple routines; the error that follows says that I am calling
certain functions that, in reality, I am not calling from any of the
routines that I wrote:

error:

> python fwrite_mat.py

  0, 0, 0, 0 ,  0, 1, 2, 3 ,  0, 2, 4, 6
Traceback (most recent call last):
  File "fwrite_mat.py", line 7, in <module>
    from xlrd import *
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/xlrd/__init__.py",
line 256, in <module>
    from timemachine import *
  File
"/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/xlrd/timemachine.py",
line 21, in <module>
    from array import array as array_array
ImportError: cannot import name array

In these lines that I pasted, for example the "array-looking" string has
nothing to do with my function, nor the import name "timemachine" or the
import name "array".

Can anyone help me understand why python is looking such libraries, and
why it keeps in memory an array that I am not using?

Here also the simple routine I wrote:

import os, sys
import xlrd
from numpy import *
from Numeric import *
from matplotlib import *

book = xlrd.open_workbook("/Users/simone/Desktop/prova.xls")
print "The number of worksheets is", book.nsheets
print "Worksheet name(s):", book.sheet_names()
sh = book.sheet_by_index(0)
print sh.name, sh.nrows, sh.ncols
for i in range(sh.nrows):
	for j in range(sh.ncols):
		print sh.row(i)
		print sh.cell_value(i, j)




More information about the Python-list mailing list