JuliaPy / JuliaPy/PyCall.jl

install default signal handlers?

Đang mở
#340 8 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Julia
Star
1.5k
Fork
186
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

### Environment
```julia
julia> VERSION
v"0.4.5"

julia> Pkg.status("PyCall")
- PyCall 1.7.2

Python 3.4.3
```

### Prerequisites

* Install `snowflake-connector-python`
* Get a snowflake account: https://sfc-bzops-1.snowflake.net/?plan=standard (requires credit card, but first 30 days are free and you can cancel before that, you might also be able to tell them that you're working on this bug and ask for a limited test account that only has access to the sample data)

### Description
After connecting to the snowflake database, the first SQL statement will always fail with a Python `TypeError('signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object',)`

This does not happen when running through python (see below)

### julia Code
```julia
julia> using PyCall

julia> @pyimport snowflake.connector as snowflake

julia> conn = snowflake.connect(user="", password="", account ="")
PyObject

julia> cs = conn[:cursor]()
PyObject

julia> cs[:execute]("SELECT current_version()")
ERROR: PyError (:PyObject_Call)
TypeError('signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object',)
File "/usr/local/lib/python3.4/dist-packages/snowflake/connector/cursor.py", line 442, in execute
_is_put_get=_is_put_get)
File "/usr/local/lib/python3.4/dist-packages/snowflake/connector/cursor.py", line 348, in _execute_helper
signal.signal(signal.SIGINT, original_sigint)

[inlined code] from /home/ubuntu/.julia/v0.4/PyCall/src/exception.jl:81
in _pycall at /home/ubuntu/.julia/v0.4/PyCall/src/PyCall.jl:546
in pycall at /home/ubuntu/.julia/v0.4/PyCall/src/PyCall.jl:568
in call at /home/ubuntu/.julia/v0.4/PyCall/src/PyCall.jl:571

julia> cs[:execute]("SELECT current_version()")
PyObject

julia> row = cs[:fetchone]()
("1.76.0",)
```

### python Code
```python
Python 3.4.3 (default, Sep 14 2016, 12:36:27)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import snowflake.connector as snowflake
>>> conn = snowflake.connect(user="", password="", account ="")
>>> cs = conn.cursor()
>>> cs.execute("SELECT current_version()")

>>> row = cs.fetchone()
>>> print(row)
('1.76.0',)
>>>
```

I can execute other statements after the first one fails, unless I leave the connection idle for a long time, in which case I will get the error again, and the very next statement will work without issue.

Any idea what could be wrong or if I could do anything to fix this?

Thanks,

Philip

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

Hướng nghiên cứu

Tái hiện lỗi với Julia, PyCall và snowflake-connector-python bằng cách sử dụng kết nối và SELECT đầu tiên được nêu trong issue. Bắt đầu từ PyCall/src/exception.jl:81 và PyCall.jl:546, sau đó kiểm tra lệnh gọi signal.signal của connector trong cursor.py:348. Hoàn thành khi câu lệnh đầu tiên và một câu lệnh sau một khoảng thời gian không hoạt động đều hoạt động mà không gặp TypeError đã được báo cáo.

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

Đánh giá

Công nghệ
python
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/100

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.