You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
fromjuliaimportMainMain.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.jlfunctionechomsg(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")
Activity
tkf commentedon Sep 16, 2018
#200 (comment) should fix the problem. Meanwhile, you can do:
terasakisatoshi commentedon Sep 17, 2018
@tkf
This work fine. Thank you !