Python struct integer overflow masking is deprecated

When create a script with Python, I get warning message Python struct integer overflow masking is deprecated. My script running well, but I dont like this warning and want to remove this. This is my simple code with Python struct integer overflow masking is deprecated warning message :

I solve this Python struct integer overflow masking is deprecated with use numpy library.We can use function uint32 (from numpy) to convert integer to unsigned integer datatype. Unsigned integer datatype have range data from 0 to 4294967295. So, we can use this unsigned integer datatype to remove warning message struct integer overflow masking is deprecated when use struct.pack function. This is modified my script to remove Python struct integer overflow masking is deprecated warning message.

1

2

3

4

5

6

7

8

9

10

11

#!/usr/bin/python

# -*- coding: utf-8 -*-

import struct

import numpy asnp

ival=3123456789

uival=np.uint32(ival)

cval=struct.pack(">i",uival)

print(cval)

With convert data from integer to unsigned integer, we can remove warning message Python struct integer overflow masking is deprecated. Are you have any method? please share if you have 🙂