| Summary: | Run as python script doesn't set sys.stdfoo.encoding | ||
|---|---|---|---|
| Product: | [Technology] DLTK | Reporter: | Jason Craig <os-dev> |
| Component: | Python | Assignee: | dltk.python-inbox <dltk.python-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | ||
| Version: | 1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
Python support has been removed |
Build Identifier: M20100211-1343 When setting up a run configuration with the DLTK Python IDE, the "Common" page of the configuration options has a field for "Console Encoding" and "Allocate Console" to allow you to create a console to view the input/output of the Python script. However, when the Python script is run, sys.stdin.encoding, sys.stdout.encoding, sys.stderr.encoding are all set to None, regardless of what encoding is chosen. This forces you to use a construct like sys.stdout = codecs.getwriter('utf-8')(sys.stdout) if you need to output any special characters, since the Python print command uses ASCII encoding if sys.stdout.encoding is None. Reproducible: Always Steps to Reproduce: 1. Create a run configuration of type "Python Script". 2. Set "Console Encoding" option on the "Common" page of the configuration. 3. Note that your script will always receive None as sys.std*.encoding.