rm-hull / luma.examples

Companion repo for running examples against the luma.oled, luma.lcd, luma.led_matrix and luma.emulator display drivers.
MIT License
370 stars 144 forks source link

Command line args do not support Unicode #97

Closed thomasw-mitutoyo-ctl closed 5 years ago

thomasw-mitutoyo-ctl commented 5 years ago

If I try to run

from luma.core import cmdline
parser = cmdline.create_parser("parser")
args=parser.parse_args("--interface spi")

it gives

error: unrecognized arguments: - - i n t e r f a c e  s p i

which looks like it has problems reading the additional 0x00 characters of the Unicode string.

thomasw-mitutoyo-ctl commented 5 years ago
"--interface spi".encode("ascii")

seems to be a workaround for the Unicode issue (although I still can't get SPI to work).

thijstriemstra commented 5 years ago

@thomasw-mitutoyo-ctl it expects an array:

parser.parse_args(['--foo', '--bar'])