question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OverflowError: unsigned byte integer is greater than maximum

See original GitHub issue

When my dataset goes to 77000+ images, there is an error:

Traceback (most recent call last): File "convert-images-to-mnist-format.py", line 46, in <module> header.append(long('0x'+hexval[2:][2:],16)) OverflowError: unsigned byte integer is greater than maximum

Can anybody help me? I think it is because images too many, how to fix it?

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:9

github_iconTop GitHub Comments

3reactions
richardimmscommented, Aug 10, 2018

Hey,

So my solution to this was to do the following.

` hexval = “{0:#0{1}x}”.format(len(FileList),10) # number of files in HEX

    # header for label array

    header = array('B')
    header.extend([0,0,8,1])
    header.append(int('0x'+hexval[2:][:2],16))
    header.append(int('0x'+hexval[4:][:2],16))
    header.append(int('0x'+hexval[6:][:2],16))
    header.append(int('0x'+hexval[8:][:2],16))

    
    data_label = header + data_label

    hexval = "{0:#0{1}x}".format(width,10) # width in HEX
    header.append(int('0x'+hexval[2:][:2],16))
    header.append(int('0x'+hexval[4:][:2],16))
    header.append(int('0x'+hexval[6:][:2],16))
    header.append(int('0x'+hexval[8:][:2],16))

    hexval = "{0:#0{1}x}".format(height,10) # height in HEX
    header.append(int('0x'+hexval[2:][:2],16))
    header.append(int('0x'+hexval[4:][:2],16))
    header.append(int('0x'+hexval[6:][:2],16))
    header.append(int('0x'+hexval[8:][:2],16))

`

0reactions
KumarLamiccommented, Mar 4, 2020

that was just a random trial and it worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

I keep getting overflowError: unsigned short is greater than ...
Sounds like somewhere an integer exceeds the maximum limit that it can hold. Without giving us an exact error code it'll be a...
Read more >
comparison of characters in C & python - Stack Overflow
it's actually giving: OverflowError: unsigned byte integer is greater than maximum. and it's because the %c format expects a single byte, ...
Read more >
Inconsistency in overflow error messages of integer argument
... line 1, in <module> OverflowError: unsigned byte integer is greater than maximum >>> _testcapi.getargs_b(-1000) Traceback (most recent ...
Read more >
A brand new website interface for an even better experience!
OverflowError : unsigned byte integer is greater than maximum.
Read more >
integer overflow - Python - Bytes
OverflowError : unsigned short is greater than maximum. The number was around 65536 so it makes sense that it would overflow a
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found