Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 312114 - Run as python script doesn't set sys.stdfoo.encoding
Summary: Run as python script doesn't set sys.stdfoo.encoding
Status: CLOSED WONTFIX
Alias: None
Product: DLTK
Classification: Technology
Component: Python (show other bugs)
Version: 1.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: dltk.python-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-07 14:50 EDT by Jason Craig CLA
Modified: 2020-01-03 07:54 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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