JuliaPy / JuliaPy/PyCall.jl

install default signal handlers?

Aperta
#340 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Julia
Stelle
1.5k
Fork
186
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Reproduce the failure with Julia, PyCall, and snowflake-connector-python using the connection and first SELECT shown in the issue. Start at PyCall/src/exception.jl:81 and PyCall.jl:546, then inspect the connector's signal.signal call in cursor.py:348. Done means the first statement and a statement after an idle period work without the reported TypeError.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
python
Ambito
backend
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.