Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312114

Summary: Run as python script doesn't set sys.stdfoo.encoding
Product: [Technology] DLTK Reporter: Jason Craig <os-dev>
Component: PythonAssignee: 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:

Description Jason Craig CLA 2010-05-07 14:50:10 EDT
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.
Comment 1 Dawid Pakula CLA 2020-01-03 07:54:21 EST
Python support has been removed