Subject: Re: bug#26326: 25.1; "import codecs, os; ..." Weird output in python shell Mac OS X

From: Noam Postavsky <[email-masked]>
Date: Fri, 31 Mar 2017 15:53:57 -0400

merge 25753 26326
quit

On Fri, Mar 31, 2017 at 3:14 PM, Monib Ahmed <[email-masked]> wrote:
>
> Hi, I wrote a simple "Hello World" python script, and the output is
> weird:
>
>>>> import codecs, os;__pyfile =
>>>> codecs.open('''/var/folders/f9/y1xt5ytn02v2n7p8pk3_h4xw0000gn/T/py1281TtN''',
>>>> encoding='''utf-8''');__code =
>>>> __pyfile.read().encode('''utf-8''');__pyfile.close();os.remove('''/var/folders/f9/y1xt5ytn02v2n7p8pk3_h4xw0000gn/T/py1281TtN''');exec(compile(__code,
>>>> '''/Users/monibahmed/Documents/Python/people_class/hello_world.py''',
>>>> 'exec'));
> Hi
> Hello World!
>>>>
>
> Any recommendation on how to fix this?

Perhaps you can figure out how to make Emacs' python code (see
__PYTHON_EL_native_completion_setup() in python.el) work properly with
a libedit based readline?

Otherwise, you can work around it by installing a GNU readline based
readline module:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=25753#74