Syntax Error: Python3.2.2 & IPython 0.12dev

Nov 8, 2011 at 9:57 AM

Hi,

when one tries to use the IPython 0.12dev REPL with Python3.2.2 PTVS stumbles over a syntax error:

Error using selected REPL back-end:
Traceback (most recent call last):
  File "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.1\visualstudio_py_repl.py", line 1023, in _run_repl
    backend_type = getattr(__import__(backend_mod_name), backend_name)
  File "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.1\visualstudio_ipython_repl.py", line 153
    self.km.start_kernel(**{'ipython': True, 'extra_arguments': [u'--pylab=inline']})
                                                                                 ^
SyntaxError: invalid syntax

Using standard backend instead

I tried removing the apparently offending u-indicator in front of the argument string but this only results in another error:

Error using selected REPL back-end:
Traceback (most recent call last):
  File "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.1\visualstudio_py_repl.py", line 1023, in _run_repl
    backend_type = getattr(__import__(backend_mod_name), backend_name)
  File "c:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.1\visualstudio_ipython_repl.py", line 5, in 
    from IPython.zmq import kernelmanager
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\__init__.py", line 43, in 
    from .config.loader import Config
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\config\loader.py", line 27, in 
    from IPython.utils.path import filefind, get_ipython_dir
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\path.py", line 24, in 
    from IPython.utils.process import system
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\process.py", line 25, in 
    from ._process_win32 import _find_cmd, system, getoutput, AvoidUNCPath
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\_process_win32.py", line 26, in 
    from . import text
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\text.py", line 29, in 
    from IPython.utils.io import nlprint
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\io.py", line 90, in 
    stdin = IOStream(sys.stdin)
  File "C:\Program Files\Python32\lib\site-packages\ipython-0.12.dev-py3.2.egg\IPython\utils\io.py", line 32, in __init__
    raise ValueError("fallback required, but not specified")
ValueError: fallback required, but not specified

Using standard backend instead

Any idea of how to get this working? I would like to use PTVS for exploratory scientific numerical analysis and e.g. the possibility to print a list of currently assigned variables via the IPython magic command %whos is quite important to me.

Many thanks

Coordinator
Nov 9, 2011 at 11:45 PM

Thanks for the report, I haven't had a chance to look at it yet, but I will investigate it tomorrow and should have a proposed workaround.  You might be able to just remove ", 'extra_arguments': [u'--pylab=inline']" entirely - that only enables inline graphs but I haven't had a chance to test that yet.

Coordinator
Nov 14, 2011 at 6:49 PM

It looks like on Python 3.x sys.stdin can be None when we're running w/ the output redirected.  We'll need to setup our sys.stdin before import IPython to fix this.

I've opened an issue to track getting everything fixed here: http://pytools.codeplex.com/workitem/595

Thanks for the report!