JuliaPy / JuliaPy/PyCall.jl

install default signal handlers?

Offen
#340 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Julia
Sterne
1.5k
Forks
186
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.