The port parameter of serial.Serial should be /dev/ttyu0 instead of COM1, and /dev/ttyu1 instead of COM2. Strangely, pyserial will accept the number 0, but then it tries to open a device that exists on Linux only... Anyway, problem solved.