473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Traceback (most recent call last): PROBLEM

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)
Oct 12 '07 #1
1 27788
smarras wrote:
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
"import xlrd" triggers the execution of the file .../xlrd/__init__.py
containing the statement "from timemachine import *" which in turn causes
..../xlrd/timemachine.py to execute. The latter file contains "from array
import array as array_array", so yes you are using "array" though
indirectly -- or you would if the import didn't fail.

The cause of the failure is probably a script named "array.py" that you
have written and put in the same folder as fwrite_mat.py. Rename
your array.py, remove the corresponding array.pyc, and the error should go
away.

Peter
Oct 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Shaiguy | last post by:
I have a table containing the following fields: ProjectUpdateID (PrimaryKey) ProjectID UpdateDate I would like to create a Query in Ms Access 2000 which will return me the most recent 2...
6
by: Mark | last post by:
hi, i want to display the five most recent rows in my table (there is a timestamp), but sorted in ascending order. the problem is that when i call SELECT * FROM spam ORDER BY time ASC LIMIT...
4
by: Lee | last post by:
I have an application where I need to find the most recent file placed in a folder. For example, my users periodically place an image file with the format "ImageXXXX.jpg" (where XXXX is some...
4
by: Sector 7G | last post by:
I'm working with a SQL query for a Human Resources database. Its intended purpose is to find all the paycheck records with a check date (prckhist.chkdate ) more recent than eleven days past the...
4
by: zacks | last post by:
Most applications whose purpose is to work with various types of files implement a "Most Recent Files" list, where the last, say, four files accessed by the application can quickly be re-opened by...
0
by: smarras | last post by:
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...
3
by: AnthonyT | last post by:
Hi All I have a major problem with an access query and I am near the end of my tether! I have taken over a project with a badly built access database and as resources are not available to start...
1
by: lutz | last post by:
I fully admit, I am begging for some help. I am at the mercy of anyone's generous nature. I wish I had a template to follow for this one. I thank you in advance for anyone's advice. Maybe...
1
by: deiv82 | last post by:
Hi, I'm trying to get in my homepage the last 10 product-schedules inserted in my website. These I should get from different tables in my database, that have all the same fields but every table has a...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.