Describe the feature you'd like
Capture UnicodeError on pexpect's expect: that exception means that the output received from the interpreter cannot be decoded (wrong encoding or it is not a valid unicode at all).
Print a nice message explaining that and showing that the encoding can be changed using --encoding.
Do the same when opening a file.