Problem with "Send To Interactive"

Dec 1, 2011 at 4:51 AM

Hi,

I get errors when try to send to following code snippet to the interactive as a whole:

def func1(s):
    print s

def func2(i):
    print i+1

func1('abc')
func2(123)

This is the output of the interactive:

>>> def func1(s):
...     print s
... 
... def func2(i):
... 
  File "", line 4
    def func2(i):
      ^
SyntaxError: invalid syntax
>>>     print i+1
  File "", line 1
    print i+1
   ^
IndentationError: unexpected indent
>>> 
>>> func1('abc')
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'func1' is not defined
>>> func2(123)
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'func2' is not defined
>>> 
I am using PTVS 1.1 alpha.
I've tried using CPython 2.7 and IronPython 2.7, both result the same error.
However, if I try to evaluate the two functions one by one, everything's fine.
I'm not sure if it's a bug of PTVS or just it's me that doing something wrong.
Could anybody help?
Thanks
Coordinator
Dec 2, 2011 at 9:18 PM

Thanks for the report...  This is definitely a bug, we're supposed to do some smart splitting of the text when doing send to interactive rather than requiring you to split it by hand.  I've opened this bug for the issue: http://pytools.codeplex.com/workitem/606

Coordinator
Dec 2, 2011 at 11:02 PM

I've checked in a fix for this: http://pytools.codeplex.com/SourceControl/changeset/changes/db1a493a24d2