Opened 6 years ago

Last modified 4 years ago

#47827 assigned defect

python34 @3.4.3_2 ANSI escape code are disabled on input() with readline module

Reported by: maoutwo@… Owned by: jmroot (Joshua Root)
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: Cc: ned-deily (Ned Deily)
Port: python34


On OS X 10.9.5 with XCode 6.2, python34 @3.4.3_2 disables ANSI escape code on input() with readline module.

For example, the following command is executed by python34 @3.4.3_2 and Python 3.4.3 from

python -c 'import readline; input("\x1b[31;1mthis is a bold red prompt> \x1b[m");'

python34 @3.4.3_2 displays the following. ANSI escape code are displayed.

[31;1mthis is a bold red prompt> [m

Python 3.4.3 from displayes the following. And the output is red and bold.

this is a bold red prompt>

Change History (4)

comment:1 Changed 6 years ago by larryv (Lawrence Velázquez)

Cc: nad@… added; jwa@… openmaintainer@… removed
Owner: changed from macports-tickets@… to jwa@…

comment:2 Changed 6 years ago by ned-deily (Ned Deily)

I can reproduce the problem (on 10.10) as long as port py34-readline is not also installed. By default, MacPorts Pythons are linked with the MacPorts-provided BSD libedit library. The py*-readline ports replace the corresponding Python readline modules with ones linked with the (MacPorts-provided) GNU readline instead of libedit. The Pythons from installers currently link with the Apple-supplied libedit in OS X; those versions of libedit are older than the current MacPorts one. So, one workaround is to just install py34-readline. That is currently required for some other ports, like py34-ipython, anyway.

There has been at least one other issue reported previously on the Python bug tracker that seemed to implicate the newer version of libedit provided in MacPorts ( I meant to investigate it further before taking action, like reporting upstream, but I haven't gotten to it yet. Feel free to jump in.

comment:7 Changed 6 years ago by maoutwo@…

Thank you for response.

Installing of py34-readline resolves this problem on OS X 10.9.5.

comment:8 Changed 4 years ago by jmroot (Joshua Root)

Owner: changed from jyrkiwahlstedt to jmroot
Status: newassigned
Note: See TracTickets for help on using tickets.