Extracting a short using struct - won't print.

Graham Nicholls graham at rockcons.co.uk
Thu Aug 7 17:44:54 CEST 2003

Thanks to Richard and Alex, I'm doing this:

        if debug:
                print ("DEBUG: Image [%s] is [%d] by [%d] pixels" % (self.fname,x,y))

Expecting to extract a filler byte (ignored), then a big-endian short (a
python integer) , then another of the same.  When I try to print, I get

File "./pdf_merge", line 426, in getsize
    print ("DEBUG: Image [%s] is [%d] by [%d] pixels" % (self.fname,x,y))
TypeError: int argument required

What am I missing - its probably something simple - earlier I spent half an
hour wondering why I was getting a message that "img_file has no object
getsize()" from x,y=img.getsize().  It turned out to be because I had got
def getsize: indented one indent too far in the class definition.  Aaargh!

Python is 2.3b1.

Graham Nicholls
Rock Computer Consultancy

More information about the Python-list mailing list