My favorites | Sign in
Project Home Downloads Wiki Issues Source
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 616: Encoding got from environment may be invalid and crash execution on Unixes
1 person starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  pekka.klarck
Closed:  Aug 2010

Sign in to add a comment
Project Member Reported by pekka.klarck, Aug 18, 2010
The framework tries to get the encoding to use when writing to, and reading from, the console from the encoding used in sys.stdout and sys.stdin. This fails, at least, when both stdin and stdout are redirected, and a plan b is needed. On Windows the framework just uses the default Dos encoding cp437, and on Unixes it tries to find correct encoding from the environment variables. It doesn't, however, verify that the encoding it gets is correct, and invalid encoding may crash the whole execution. A way to reproduce this, at least on Linux, is running this command, which results on LookupError:

  echo "redirect stdin" | LANG=invalid pybot tests.txt > stdout.txt 

It seems that on OSX this problem occurs more often than on Linux (at least on Ubuntu). The problem in  issue 594  is most likely caused by this too, and similar symptoms are visible also on the comment by frank_fen to Installation wiki page:
Aug 18, 2010
Project Member #1 pekka.klarck
 Issue 594  has been merged into this issue.
Aug 18, 2010
Project Member #2 pekka.klarck
frank_fen, if you happen to see this issue, could you please tell what you got when running the following command:

    echo $LANG - $LC_TYPE - $LANGUAGE - $LC_ALL

It prints out all the environment variables that are used when trying to find the encoding, and I'd like to know what exact values you originally get to be able to fix the issue as well as possible.

Summary: Encoding got from environment may be invalid and crash execution on Unixes
Aug 19, 2010
Project Member #3 pekka.klarck
Fixed in r3851 by verifying the encoding. If no valid encoding is found, ASCII is used as default.
Status: Done
Owner: pekka.klarck
Sign in to add a comment

Powered by Google Project Hosting