New submission from Kadir Haldenbilen <>:

on terminal push and runcode accepts indentation where required (like for loop 
etc), within script gives error message

on terminal import works properly and objects can be found  as normal, within 
script you may need to add module name upfront

simple example
import code
ii = code.InteractiveConsole()
ii.push("for ii in range(3):")
ii.push("    print('i', i)")

you will get normal expected output on terminal, but indentation error within 

ii.push("from time import sleep")
will sleep 1 sec on terminal, but will give name error

messages: 315224
nosy: Kadir Haldenbilen
priority: normal
severity: normal
status: open
title: InteractiveConsole behaves differently when used on terminal and used 
within script
type: behavior
versions: Python 3.6

Python tracker <>
Python-bugs-list mailing list

Reply via email to