I have experimented with simple Python arithmetics. My intention is to do some temperature transducer normalisations, where the basic data comes from the AD converter of the GE865. It is in integer form, spanning from 0 to 2047 I suppose.
As a result I would like to get a number with one decimal. Therefore I have icluded one desimal in the divider of the formula, run here on PythonWin with simple data taken from a live example, the value of the AD converter being 907:
>>> print (907-600)/10.0 30.7
If I let the divider also be an integer, it gives me:
>>> print (907-600)/10 30
All above is according to Python type mixing rules, I guess. But running the same examples on the GE865 work only if I use the latter expression:
print (907-600)/10
It prints 30 (as expected).
Trying to run the other alternative on GE865:
print (907-600)/10.0
It only results in the following debug output, without printing anything:
RuntimeError: Bad code object in .pyc file
Is this a bug or have I missed something essential here? Why these differing results between PythonWin and GE865 Python execution?
Thanks for any help.
Tom
I suppose is because of floating point type which is not supported in module Python.
We use cookies to enhance your browsing experience and help us improve our websites. To improve our website, we carefully select third parties that use cookies to allow us to serve specific content and achieve the purposes set out in our cookie policy. For more information on how to make adjustments through your browser to the cookies being used on your device, please click Find Out More link. By closing this banner or continuing to browse our website, you agree to our use of such cookies. FIND OUT MORE
Hello all,
I have experimented with simple Python arithmetics. My intention is to do some temperature transducer normalisations, where the basic data comes from the
AD converter of the GE865. It is in integer form, spanning from 0 to 2047 I suppose.
As a result I would like to get a number with one decimal. Therefore I have icluded one desimal in the divider of the formula, run here on PythonWin with simple data taken from a live example, the value of the AD converter being 907:
>>> print (907-600)/10.0
30.7
If I let the divider also be an integer, it gives me:
>>> print (907-600)/10
30
All above is according to Python type mixing rules, I guess. But running the same examples on the GE865 work only if I use the latter expression:
print (907-600)/10
It prints 30 (as expected).
Trying to run the other alternative on GE865:
print (907-600)/10.0
It only results in the following debug output, without printing anything:
RuntimeError: Bad code object in .pyc file
Is this a bug or have I missed something essential here? Why these differing results between PythonWin and GE865 Python execution?
Thanks for any help.
Tom
I suppose is because of floating point type which is not supported in module Python.