transport, pw = yield from asyncio.get_event_loop() - SyntaxError: invalid syntax #220

Closed
nagappan opened this Issue May 29, 2015 · 7 comments

Comments

Projects
None yet
5 participants

In Ubuntu 14.04, any suggestions to fix ?

/usr/bin/python setup.py install
running install
running build
running build_py
running install_lib
creating /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/screen.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/init.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/replwrap.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/expect.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/async.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/FSM.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/pxssh.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/fdpexpect.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/ANSI.py -> /usr/local/lib/python2.7/dist-packages/pexpect
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/screen.py to screen.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/init.py to init.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/replwrap.py to replwrap.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/expect.py to expect.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/async.py to async.pyc
File "/usr/local/lib/python2.7/dist-packages/pexpect/async.py", line 15
transport, pw = yield from asyncio.get_event_loop()
^
SyntaxError: invalid syntax

byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/FSM.py to FSM.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/pxssh.py to pxssh.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/fdpexpect.py to fdpexpect.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/ANSI.py to ANSI.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/pexpect-3.3.egg-info

Owner

takluyver commented May 29, 2015

It should install fine anyway. That module is only relevant on python 3, but the rest of pexpect will work without it.

git clone git://github.com/pexpect/pexpect.git
Cloning into 'pexpect'...
remote: Counting objects: 5407, done.
remote: Total 5407 (delta 0), reused 0 (delta 0), pack-reused 5407
Receiving objects: 100% (5407/5407), 8.33 MiB | 5.57 MiB/s, done.
Resolving deltas: 100% (3114/3114), done.
Checking connectivity... done.

/pexpect# /usr/bin/python setup.py build
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
copying pxssh.py -> build/lib.linux-x86_64-2.7
copying fdpexpect.py -> build/lib.linux-x86_64-2.7
copying FSM.py -> build/lib.linux-x86_64-2.7
copying screen.py -> build/lib.linux-x86_64-2.7
copying ANSI.py -> build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pexpect
copying pexpect/screen.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/pty_spawn.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/init.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/utils.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/replwrap.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/spawnbase.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/expect.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/async.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/FSM.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/pxssh.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/fdpexpect.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/ANSI.py -> build/lib.linux-x86_64-2.7/pexpect
copying pexpect/exceptions.py -> build/lib.linux-x86_64-2.7/pexpect
root@promc-2s-109-dhcp174:
/pexpect# /usr/bin/python setup.py install
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running install
running build
running build_py
running install_lib
copying build/lib.linux-x86_64-2.7/screen.py -> /usr/local/lib/python2.7/dist-packages
copying build/lib.linux-x86_64-2.7/pexpect/screen.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/pty_spawn.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/init.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/utils.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/replwrap.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/spawnbase.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/expect.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/async.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/FSM.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/pxssh.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/fdpexpect.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/ANSI.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/pexpect/exceptions.py -> /usr/local/lib/python2.7/dist-packages/pexpect
copying build/lib.linux-x86_64-2.7/FSM.py -> /usr/local/lib/python2.7/dist-packages
copying build/lib.linux-x86_64-2.7/pxssh.py -> /usr/local/lib/python2.7/dist-packages
copying build/lib.linux-x86_64-2.7/fdpexpect.py -> /usr/local/lib/python2.7/dist-packages
copying build/lib.linux-x86_64-2.7/ANSI.py -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/screen.py to screen.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/screen.py to screen.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/pty_spawn.py to pty_spawn.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/init.py to init.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/utils.py to utils.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/replwrap.py to replwrap.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/spawnbase.py to spawnbase.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/expect.py to expect.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/async.py to async.pyc
File "/usr/local/lib/python2.7/dist-packages/pexpect/async.py", line 16
transport, pw = yield from asyncio.get_event_loop()
^
SyntaxError: invalid syntax

byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/FSM.py to FSM.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/pxssh.py to pxssh.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/fdpexpect.py to fdpexpect.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/ANSI.py to ANSI.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pexpect/exceptions.py to exceptions.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/FSM.py to FSM.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/pxssh.py to pxssh.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/fdpexpect.py to fdpexpect.pyc
byte-compiling /usr/local/lib/python2.7/dist-packages/ANSI.py to ANSI.pyc
running install_egg_info
Writing /usr/local/lib/python2.7/dist-packages/pexpect-4.0.dev.egg-info

Owner

takluyver commented May 29, 2015

Just ignore the error and use it anyway. That part of the code is not for Python 2, so it doesn't matter.

@takluyver takluyver closed this May 29, 2015

Thanks

Hey, however, this is an issue for distributions like ubuntu which pre-compiles the .py in .pyc at install time (once for python2, once for python3).
python-pexpect will fail to install (like in https://bugs.launchpad.net/ubuntu/+source/ubuntu-make/+bug/1507871) due to this. It seems the "yield from" python2 shims are not straightforward, any suggestions?

@nagappan I got solution!
run following command,
mv /usr/local/lib/python2.7/dist-packages/pexpect/async.py /usr/local/lib/python2.7/dist-packages/pexpect/async.py.old && sudo apt-get dist-upgrade && mv /usr/local/lib/python2.7/dist-packages/pexpect/async.py.old /usr/local/lib/python2.7/dist-packages/pexpect/async.py

Member

jquast commented Nov 5, 2015

@sagarpanchal @didrocks you may also patch MANIFEST.in to exclude the same. The project works fine with the file removed, as it is conditionally imported for only python 3:

echo 'exclude pexpect/async.py' >> MANIFEST.in

@Lazar-T Lazar-T referenced this issue in jonathanslenders/python-prompt-toolkit Apr 4, 2016

Open

ptipython raises KeyError: 'extensions' #273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment