Skip to content

Both arguments of PipeTransport constructor must be file objects #22

@kalkehcoisa

Description

@kalkehcoisa

Hey guys! I'm using ppft 1.6.6.1 on Python 2.7.12 linux and it's causing me this problem:

2020-06-05 09:57:07,496 INFO  [pp][DummyThread-12] Running on Python 2.7.12 linux2
[2020-06-05 09:57:07 +0000] [11841] [ERROR] Error handling request /test_request
Traceback (most recent call last):
  File "/home/an_env/local/lib/python2.7/site-packages/gunicorn/workers/async.py", line 56, in handle
    self.handle_request(listener_name, req, client, addr)
...
...
...
  File "/home/an_workspace/ref-diffs/ref_diffs/helpers.py", line 26, in async_requests
    JOB_SERVER = pp.Server(ppservers=())
  File "/home/an_env/local/lib/python2.7/site-packages/ppft/_pp.py", line 358, in __init__
    self.set_ncpus(ncpus)
  File "/home/an_env/local/lib/python2.7/site-packages/ppft/_pp.py", line 522, in set_ncpus
    range(ncpus - len(self.__workers))])
  File "/home/an_env/local/lib/python2.7/site-packages/ppft/_pp.py", line 155, in __init__
    self.start()
  File "/home/an_env/local/lib/python2.7/site-packages/ppft/_pp.py", line 162, in start
    self.t = pptransport.CPipeTransport(proc.stdout, proc.stdin)
  File "/home/an_env/local/lib/python2.7/site-packages/ppft/transport.py", line 128, in __init__
    raise TypeError("Both arguments of PipeTransport constructor " \
TypeError: Both arguments of PipeTransport constructor must be file objects

Checking around, I discovered the cause. The classes used in gevent for file readers and writers aren't properly detected as file objects. Yet, they are. So the error in transport.py is a bug.
I'm using version 1.6.6.1 installed from pip and noticed that the current code solves the issue.
Is there any deployment to pip of a newer version scheduled?
If so, it's going to save a considerable amount of work on automation scripts.

Anyway, thanks a lot for the project.
It saved us big time to be able to use async in python2 ;)
PS: we are little by little migrating to py3, but it takes lots of time and $$ we don't have right now

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions