Hi Hans, Glad you got it working, I'll add some examples to README. Right now pyjulia is demoware, cool to show off than you can do it but still just a toy. Supporting python 3.4 looks like it is going to be a pain as the whole meta-import machinery changed. Best to use python 2.7 and avoid unicode for the time being :-)
Hope your presentation goes well, Jake On Monday, September 1, 2014 6:41:48 PM UTC-4, Hans W Borchers wrote: > > Jake, thanks, it now works as you say; very nice. > > I was referring to the examples in Leah Hanson's blog entry > > http://blog.leahhanson.us/julia-calling-python-calling-julia.html > > which appear to be out-of-date. It would be helpful to have some > of your examples in the README file of the 'pyjulia' package. > > > On Monday, September 1, 2014 11:32:06 PM UTC+2, Jake Bolewski wrote: >> >> To execute arbitrary julia code it is "eval" just like python, call >> returns a void pointer to the result. >> >> examples: >> >> import julia >> julia = julia.Julia() >> julia.eval("1 +1") >> julia.sqrt(2.0) >> julia.help("sqrt") # get the help for julia's sqrt function >> >> from julia import Pkg # or any user installed package on your system >> Pkg.installed() >> Pkg.#ipython tab expansion should work for any package >> >> from julia import randn as r # should be able to import just as you would >> in python >> r(100) >> >> etc... >> >> etc... >> >> On Monday, September 1, 2014 5:02:37 PM UTC-4, Hans W Borchers wrote: >>> >>> Thanks a lot for this prompt reaction. >>> I can now import 'julia' into Python, but I don't seem to get the right >>> results: >>> >>> >>> from julia import Julia >>> >>> j = Julia() >>> >>> >>> j.eval('PyObject((1,2,3))') # works fine! >>> (1, 2, 3) >>> >>> >>> j.call('1+1') # what is this ... >>> 23296656 >>> >>> >>> j.call('sqrt(2.0)') # ... and this? >>> 173117264 >>> >>> >>> j.run('1+1') # shouldn't this work? >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> RuntimeError: Julia exception: MethodError(run,("1+1",)) >>> >>> I am sorry I bother everybody here. Maybe my installation is too >>> 'kaputt' by now. >>> >>> >>> On Monday, September 1, 2014 10:08:16 PM UTC+2, Steven G. Johnson wrote: >>>> >>>> >>>> >>>> On Monday, September 1, 2014 2:47:18 PM UTC-4, Hans W Borchers wrote: >>>>> >>>>> Jake, which muster do you mean -- what would I need to reinstall? >>>>> >>>> >>>> He means pyjulia master (do a 'git pull origin master' in the pyjulia >>>> directory). >>>> >>>
