Good enough reason to try! I got the 2022.07 release from brew. Then zef install -v Inline::Python --exclude=python3 (the same incantation I used before) failed with:
===> Searching for: Inline::Python ===> Found: Inline::Python:ver<0.5>:auth<cpan:NINE> [via Zef::Repository::LocalCache] ===> Building: Inline::Python:ver<0.5>:auth<cpan:NINE> [Inline::Python] Command: /usr/local/Cellar/rakudo-star/2022.07/bin/rakudo -MMONKEY-SEE-NO-EVAL -e exit((require ::(q|Distribution::Builder::MakeFromJSON|)).new(:meta(EVAL($*IN.slurp(:close)))).build(q|/Users/seanmcafee/.zef/store/Inline-Python-0.5.tar.gz/Inline-Python-0.5|)??0!!1) ===> Building [FAIL]: Inline::Python:ver<0.5>:auth<cpan:NINE> Aborting due to build failure: Inline::Python:ver<0.5>:auth<cpan:NINE> (use --force-build to override) Not much there to tell me what's wrong. I gamely added --force-build and tried again. This time the unit tests for Inline::Python failed (eg. "SystemError: frame does not exist" (looks like a Python error), "This container does not reference a native unsigned integer"). It looks like this somewhat old but unaddressed open issue: https://github.com/niner/Inline-Python/issues/44. There was a suggestion to add --force-test to override. I tried that and returned to the previous status quo: empty array, "instance has no attribute 'sql'". On Fri, Sep 9, 2022 at 11:48 AM Elizabeth Mattijsen <l...@dijkmat.nl> wrote: > Well, if you would like people to look into possible core issues, then it > would help using the latest released version (aka 2022.07). Especially > since 2021.04 is from before the new-disp work being merged, so it is not > completely unlikely it functions better now. > > > On 9 Sep 2022, at 20:44, Sean McAfee <eef...@gmail.com> wrote: > > > > I still see the same behavior. That is, if I do say spark.sql('select > 1+1'); twice, the first time prints an empty array, and the second produces > the "instance has no attribute 'sql'" error message. > > > > I forgot to mention, this is on a somewhat old version of Raku, > 2021.04. But then, Inline::Python seems to be mostly even older. > > > > > > On Fri, Sep 9, 2022 at 11:35 AM Elizabeth Mattijsen <l...@dijkmat.nl> > wrote: > > To rule out any REPL artefacts, do you see the same thing if you put the > code in a script and run the script? > > > > > On 9 Sep 2022, at 20:17, Sean McAfee <eef...@gmail.com> wrote: > > > > > > Hello-- > > > > > > I recently started playing around with PySpark. It soon occurred to > me that it would be a lot more fun to work in Raku instead of Python, and I > recalled that it's supposed to be possible to get handles to Python objects > from Raku and call methods on them seamlessly, so I tried to make it > happen. I got pretty far, but now I'm stymied. Here are the steps I can > take in the Raku interpreter: > > > > > > > use Inline::Python > > > Nil > > > > my \python = Inline::Python.new > > > Inline::Python.new > > > > > > Self-explanatory. > > > > > > > python.run('from pyspark.sql import SparkSession') > > > (Any) > > > > > > No errors, that looks promising... > > > > > > > my \spark = python.run('SparkSession.builder.getOrCreate()', :eval) > > > ... spam from initialization of Spark session deleted... > > > Inline::Python::PythonObject.new(ptr => > NativeCall::Types::Pointer.new(4461193984), python => Inline::Python.new) > > > > > > Now we're getting somewhere! (I had to source-dive to guess that I > needed that :eval; without it, an Any is returned.) > > > > > > > my \sql = spark.sql('select 1+1') > > > [] > > > > > > Uh...what? I was expecting to get another Python object back, a > DataFrame. (I think; I'm much more familiar with the Scala interface to > Spark.) Instead I have an empty array. > > > > > > Even more puzzlingly, if I re-run that last statement, I get an error: > "instance has no attribute 'sql'". If I re-run the statement over and > over, the response alternates between an empty array and that error. > > > > > > Does anyone have any insight into what's going on? > > > > > > >