This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: importing rlcompleter module writes a control sequence in stdout
Type: behavior Stage: resolved
Components: Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Importing readline produces erroneous output
View: 19884
Assigned To: Nosy List: eric.araujo, r.david.murray, valva
Priority: normal Keywords:

Created on 2011-10-13 12:35 by valva, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (3)
msg145452 - (view) Author: Valvanuz (valva) Date: 2011-10-13 12:35
When you import the module rlcompleter in a python script in Centos 6 (x86_64), the control sequence \033[?1034h is printed in stdout. The problem is that these sequence is not visible by the user and cause a lot of confusion. 

In my case I compared the output of a python script (the integer 6) in bash and I got:

 test: 6: integer expression expected

How to reproduce:

 =============================
 BASH SCRIPT that calls test.py
 =============================
 id=$(./test.py)
 echo $id|sed -n l
 if test ${id} -eq 0;then
 fi

 =========
 test.py
 =========
 #!/usr/bin/python
 import rlcompleter
 a=2
 print a

========
OUTPUT
========
[valva@wn009 ~]$ bash p.sh 
\033[?1034h2$
p.sh: line 3: test: 2: integer expression expected


This only has happened to me in Centos 6 (python 2.6.5) I've tested in Centos 5, debian and Ubuntu and it does not happen.
msg145960 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-19 20:41
Can you give a simpler script (maybe in Python :) to reproduce this?  Also, 2.6 only gets security fixes now, so please use 2.7, 3.2 or 3.3.
msg241034 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-14 21:32
Duplicate of 19884.
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57373
2015-04-14 21:32:54r.david.murraysetstatus: open -> closed

superseder: Importing readline produces erroneous output

nosy: + r.david.murray
messages: + msg241034
resolution: duplicate
stage: resolved
2011-10-19 20:41:04eric.araujosetnosy: + eric.araujo

messages: + msg145960
versions: + Python 2.7, Python 3.2, Python 3.3, - Python 2.6
2011-10-13 12:35:20valvacreate