JuliaPy / JuliaPy/PyCall.jl

Can't convert from PyPtr to related type

Aperta
#1,043 2 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

Hello everyone and thanks for the great library. I was trying to use rdflib of Python in PyCall.jl. I'm using macos, Julia 1.9.1 and using `ENV["Python"]=""` with Conda.jl. With this code,

```julia
using PyCall

# Create an empty graph
graph = pyimport("rdflib").Graph()

# Define the namespace
ex = "http://example.org/"

# Define the triples
subject = pyimport("rdflib").URIRef(ex * "subject")
predicate = pyimport("rdflib").URIRef(ex * "predicate")
object = pyimport("rdflib").Literal("object")

# Add the triples to the graph
graph.add((subject, predicate, object))
```

I got the following output
```julia
ERROR: PyError ($(Expr(:escape, :(ccall(#= /Users/hiiroo/.julia/packages/PyCall/ilqDX/src/pyfncall.jl:43 =# @pysym(:PyObject_Call), PyPtr, (PyPtr, PyPtr, PyPtr), o, pyargsptr, kw)))))
AssertionError('Subject http://example.org/subject must be an rdflib term')
File "/Users/hiiroo/.julia/conda/3/lib/python3.7/site-packages/rdflib/graph.py", line 532, in add
assert isinstance(s, Node), "Subject %s must be an rdflib term" % (s,)
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Reproduce the macOS Julia 1.9.1 example with PyCall.jl, Conda.jl, and rdflib. Start at PyCall's src/pyfncall.jl:43 and the rdflib assertion in graph.py, then trace how the URIRef and Literal arguments are converted. Done means the graph.add call accepts the created rdflib terms without the assertion error.

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

Valutazione

Stack tecnologico
python
Ambito
tooling
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.