The carbonbased lifeform John Machin inspired comp.lang.python with: > On Apr 28, 9:50 pm, "Theo v. Werkhoven" <[EMAIL PROTECTED] > werkhoven.nl.invalid> wrote: >> Goodday, >> >> strg = array("B",octarray).tostring() > > The above statement appears to be where the error manifests itself. > Possibilities: (1) array is bound to a list (2) the result of > array("B", octarray) has an attribute tostring which is bound to a > list. Option (1) seems less implausible. I'd be replacing that line > by: > > print "octet %r, shift %r, array %r" % (octet, shift, array) > array_b = array("B", octarray) > print "array_b %r" % array_b > print "array_b.tostring %r" % array_b.tostring > strg = array_b.tostring() > > You haven't shown us all of your code -- is array mentioned elsewhere? > What other imports are you doing? Do you have a file called array.py > in the offending directory? [I believe that this wouldn't matter, > because builtin modules like array can't be overridden by a file-based > module of the same name, but I could be wrong]
Bingo! #v+ theo:/home/theo/Devel/Python $ ls array* array.py array.pyc theo:/home/theo/Devel/Python $ cat array.py #!/usr/bin/python import sys, os array = [14, 8765, 756, 5345, 98, 5634654, 234123, 9087, 58, 297, 7865] num = 0 while 1: try: print num num = num + array.pop() except: break #v- And that code produces the numbers I was seeing.. > What platform and what version of Python? $ python --version Python 2.5 $ uname -srv Linux 2.6.18.8-0.1-default #1 SMP Fri Mar 2 13:51:59 UTC 2007 $ uname -mip i686 athlon i386 > HTH, > John Thank you very much John. Nice catch. Theo -- theo at van-werkhoven.nl ICQ:277217131 SuSE Linux linuxcounter.org: 99872 Jabber:muadib at jabber.xs4all.nl AMD XP3000+ 1024MB "ik _heb_ niets tegen Microsoft, ik heb iets tegen de uitwassen *van* Microsoft" -- http://mail.python.org/mailman/listinfo/python-list