RasQberry icon indicating copy to clipboard operation
RasQberry copied to clipboard

python read of boolean variables in rasqberry_environment.env corrupt

Open JanLahmann opened this issue 2 years ago • 1 comments

There is an issue with reading Boolean variable in rasqberry_environment.env from python.

For example, in demos/bin/RasQ-LED-display.py, the variable "LED_INVERT" is not read correctly. The following log output:

LED_INVERT = bool(config["LED_INVERT"])
print("LED_INVERT ", LED_INVERT)
LED_INVERT = config["LED_INVERT"]
print("LED_INVERT ", LED_INVERT)
LED_INVERT = False
print("LED_INVERT ", LED_INVERT)

results in

build circuit without entanglement
measurement:  0110001001101001010011001101001110001100100110001101000010100110101110001101000000100000110001100111101110010011110011000001100
LED_INVERT  True
LED_INVERT  false
LED_INVERT  False

Only the last setting leads to the desired result.

JanLahmann avatar Oct 03 '22 19:10 JanLahmann

workaround implemented in #137 using LED_INVERT = bool(config["LED_INVERT"]=="true" or config["LED_INVERT"]=="True") instead of LED_INVERT = bool(config["LED_INVERT"]) in file demos/bin/RasQ-LED-display.py (and other files).

JanLahmann avatar Oct 03 '22 21:10 JanLahmann