JuliaPy / JuliaPy/PyCall.jl

Can't convert from PyPtr to related type

Open
#1,043 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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,)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.