0

The data-element is a float-number and no sequence (I think). But I get the error "setting an array element with a sequence".

folder = r"C:\Dokumente und Einstellungen\ssc"
contents=os.listdir(folder)

ar = zeros((81,81,256),int)
filenumber = 0

for d in contents:
    if str(".bin") in d:
        filename = os.path.join("C:\\Dokumente und Einstellungen\\ssc\\" + d)
    print filename
    c_file = open(filename,"rb")
    for k in range(8): #81
        for m in range(2): #256
            data = unpack('d',c_file.read(8))[0]
            print data
            ar[filename,k,m] = data
    filenumber += 1

1 Answer 1

1

Do you mean ar[filenumber,k,m] = data? I don't think you can index it with filename.

3
  • should I delete this question?
    – kame
    Aug 27, 2010 at 9:54
  • @kame: That's up to you I suppose, I don't know of any guidelines that say you have to delete typo questions...
    – ptomato
    Aug 27, 2010 at 10:08
  • @kame: Typo questions are common. Many programmers stare at the same variables for hours not realizing they're they wrong variable. It takes other eyes to see the obvious. But you won't get much reputation from a bad question like this.
    – S.Lott
    Aug 27, 2010 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.