473,320 Members | 1,853 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,320 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 27769
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.