-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
When we would like to use 3rd party library from Python via pyjulia
e.g. Images
which is a Julia Package , we only have to use Main.using
from julia import Main
Main.using("Images")
img = Main.eval('load("path/to/img")') # where load is a function defined in Images package
On the other hand, is there any way import or incluide our own source code ?
For example I created a trivial example:
#example.jl
function echomsg(msg)
return msg
end
Then I would like to call echomsg
defined above from Python.
I tried to from julia import Main; Main.eval('include("example.jl")')
on python REPL
but failed with the following message
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/terasakisatoshi/.pyenv/versions/miniconda3-3.19.0/lib/python3.5/site-packages/julia/core.py", line 739, in eval
ans = self._call(src)
File "/Users/terasakisatoshi/.pyenv/versions/miniconda3-3.19.0/lib/python3.5/site-packages/julia/core.py", line 672, in _call
self.check_exception(src)
File "/Users/terasakisatoshi/.pyenv/versions/miniconda3-3.19.0/lib/python3.5/site-packages/julia/core.py", line 722, in check_exception
.format(exception, src))
julia.core.JuliaError: Exception 'UndefVarError: include not defined' occurred while calling julia code:
include("example.jl")
How should I do ???
Metadata
Metadata
Assignees
Labels
No labels