Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python 3.7 compatibility #426

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

francisg-gc
Copy link

This pull request fixes #404

I remembered to:

  • Update or add unit tests if needed
  • Update or add documentation/comments if needed
  • Made sure stray files or whitespace didn't get committed
  • If significant changes, branch from develop and set to merge into develop
  • Read the guidelines for contributing

Changes:

  • async is now a reserved word :(
  • changed 1 line in wpull/driver/process.py calling asyncio.async to using an internal name _async using getattr

@makew0rld
Copy link

makew0rld commented Mar 1, 2020

When running this with Python 3.8.1, I get this error:

❯ wpull --version                                                                
Traceback (most recent call last):
  File "/home/makeworld/.local/bin/wpull", line 11, in <module>
    load_entry_point('wpull==2.0.3', 'console_scripts', 'wpull')()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 489, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2852, in load_entry_point
    return ep.load()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2443, in load
    return self.resolve()
  File "/usr/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/home/makeworld/.local/lib/python3.8/site-packages/wpull/application/main.py", line 4, in <module>
    from wpull.application.builder import Builder
  File "/home/makeworld/.local/lib/python3.8/site-packages/wpull/application/builder.py", line 12, in <module>
    from wpull.application.tasks.download import ProcessTask, ParserSetupTask, ClientSetupTask, ProcessorSetupTask, \
  File "/home/makeworld/.local/lib/python3.8/site-packages/wpull/application/tasks/download.py", line 10, in <module>
    from wpull.processor.coprocessor.phantomjs import PhantomJSParams
  File "/home/makeworld/.local/lib/python3.8/site-packages/wpull/processor/coprocessor/phantomjs.py", line 19, in <module>
    from wpull.driver.phantomjs import PhantomJSDriverParams, PhantomJSDriver
  File "/home/makeworld/.local/lib/python3.8/site-packages/wpull/driver/phantomjs.py", line 17, in <module>
    PhantomJSDriverParams = namedlist.namedtuple(
  File "/home/makeworld/.local/lib/python3.8/site-packages/namedlist.py", line 450, in namedtuple
    type_dict = {'__new__': _make_fn('__new__', _nt_new, fields, defaults),
  File "/home/makeworld/.local/lib/python3.8/site-packages/namedlist.py", line 180, in _make_fn
    code = compile(module_node, '<string>', 'exec')
TypeError: required field "posonlyargs" missing from arguments

Maybe this StackOverflow question can help?

self._stderr_reader = asyncio.async(self._read_stderr())
self._stdout_reader = asyncio.async(self._read_stdout())
_async=getattr(asyncio, 'async')
self._stderr_reader = _async(self._read_stderr())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the right way to do this is self._stderr_reader = asyncio.ensure_future(self._read_stderr())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python 3.7 compatibility
3 participants