asyncio icon indicating copy to clipboard operation
asyncio copied to clipboard

asyncio 3.4.3 breaks python 2.7

Open ssbarnea opened this issue 7 years ago • 7 comments

Installing asyncio 3.4.3 on python 2.7 break python:

  File "/usr/local/lib/python2.7/site-packages/asyncio/selectors.py", line 39
    "{!r}".format(fileobj)) from None
                               ^
SyntaxError: invalid syntax

If asyncio is not compatible with python 2.7, it should refuse to install. I am not sure which package managed to installed it.

ssbarnea avatar Jul 23 '16 12:07 ssbarnea

Hi @ssbarnea,

AsyncIO works only on Python 3.3+.

You have Trollius for Python 2.7, but not supported anymore by @haypo.

If possible, I recommend to use directly Python 3.5+ directly, for async/await syntax.

Have a nice day.

ludovic-gasc avatar Jul 23 '16 13:07 ludovic-gasc

Yes, I do know that asyncio doesn't work with Python < 3.3, but this bug is about the fact that people can install asyncio and this will break their Python installations!

This is a real bug which can be prevented with a simple python version check inside setup.py, avoiding such accidents.

What is even worse is that it will take some time for people to realise that their python 2.x is messed because of the asyncio, they will not find it right away.

ssbarnea avatar Jul 23 '16 14:07 ssbarnea

Ok.

Are you interested in to do a pull request for that ? To my understanding, a thing like that should be enough: https://github.com/KeepSafe/aiohttp/blob/master/setup.py#L59

ludovic-gasc avatar Jul 23 '16 15:07 ludovic-gasc

Fixed by #387.

ludovic-gasc avatar Jul 24 '16 20:07 ludovic-gasc

Well, I installed it today for my python 2.7 successfully. But when I tried to import asyncio I got:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/asyncio/__init__.py", line 9, in <module>
    from . import selectors
  File "/usr/local/lib/python2.7/dist-packages/asyncio/selectors.py", line 39
     "{!r}".format(fileobj)) from None
                                ^
SyntaxError: invalid syntax

jankaifer avatar Feb 19 '17 08:02 jankaifer

Same as jan. Just installed it asyncio today for Python 2.7 and got the same error.

the-dvlpr avatar Oct 07 '17 03:10 the-dvlpr

Hi,

In fact, the pull request #387 has been merged but never pushed on PyPI. @haypo @1st1 you have the rights to update the asyncio package, what we do ?

For me, we might force that the asyncio package on PyPI can be installed for Python 3.3: People might have side effects if they install asyncio module from PyPI, where the latest release is 2015-03-10 on a Python 3.6, with a more recent asyncio version.

If you have no time for that, you might give me an access on PyPI to update the package, as you like.

ludovic-gasc avatar Oct 07 '17 10:10 ludovic-gasc