[New-bugs-announce] [issue33269] InteractiveConsole behaves differently when used on terminal and used within script

Kadir Haldenbilen report at bugs.python.org
Thu Apr 12 10:55:59 EDT 2018


New submission from Kadir Haldenbilen <khaldenbilen at gmail.com>:

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 script

ii.push("from time import sleep")
ii.push("sleep(1)")
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 <report at bugs.python.org>
<https://bugs.python.org/issue33269>
_______________________________________


More information about the New-bugs-announce mailing list