JuliaPy / JuliaPy/PyCall.jl

install default signal handlers?

オープン
#340 コメント 8 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

### 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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。