Printing Promise objects from asynchronous Runner.run() raises Attribute Error

Đang mở
#996 0 bình luận 1 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Start in invoke/runners.py, where Promise inherits Result and receives its str behavior. Reproduce the example with Runner.run(..., asynchronous=True), then verify that printing the returned Promise no longer raises AttributeError about exited while promise.join() still works.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

@task
def test(c):
    promise = c.run("sleep 5", asynchronous=True)
    print(promise)
    promise.join()

As a new user of invoke, I noticed that when I would try to print the promise returned by a Runner.run call with asynchronous=True (see above code for an example), I would get the following error:

AttributeError: 'Promise' object has no attribute 'exited'

Looking at runners.py, it seems the issue is that since Promise is a subclass of Result, and so inherits its __str__ method.

Ngôn ngữ chính
Python
Star
4.8k
Fork
412
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pyinvoke/invoke

Tất cả issue của pyinvoke/invoke

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.