keerthee
keerthee

Reputation: 880

Python int too large to convert to C long in Python COM

I have a python method that calculates value and returns it. The value is

CalcData = 3941269503L. 

It is only 32 bit. Yet this is typecasted to long implicitly (suffixed by L) and when I access this method in COM in other application , I get the Python int too large to convert to C long error. I even tried typecasting it into int,but no luck

Upvotes: 0

Views: 896

Answers (1)

solidpixel
solidpixel

Reputation: 12069

The "long" C type is signed so the largest positive value it can store is 2,147,483,647. The error is indeed correct, it doesn't fit.

Try "unsigned long" and "UL" postfix on the constant.

Upvotes: 2

Related Questions