-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VirtualFileSystem NPE on indirect import of from pyexpat import *
when using openpyxl
#431
Comments
Thank you for the report. The test diff doesn't seem to matter, it seems it's always the second test that fails (if you swap the order, then You can work around the issue if you use just one global context for all the tests.
In the current release, you can do |
Edit: NVM saw your comment, will test it So what I discovered is that it (importing from openpyxl) works the first time, but not after that Shown in I tried disabling the sources cache GraalPyResources.contextBuilder()
.allowExperimentalOptions(true)
.option("python.WithCachedSources", "false")
.build(); But this does not seem to fix the issue Hopefully that helps in identifying the issue |
Hi @msimacek
Thanks, this worked, I used a lock to make it threadsafe in my environment
Does this mean it would be more "efficient" to just keep the global context in my case (low request volume) after the issue is fixed?
Interesting, is there a reason PyExpat couldn't be emulated using LLVM on Windows in this case? There is a stub that errors on Windows Line 169 in 66530d3
Thank you! |
Yes, we haven't set up building pyexpat in our Windows build (this line in our build file is guarded above by NOT WIN32). There's no reason not do other than the nuisance of setting up the library dependencies on Windows ;) |
Good to know, not a blocker for me at all The error message was just a bit confusing, I had to search the sources to find out that it is implemented on linux but not on windows - but the next person will most likely end up here ;) |
It will be better to use one global context even after this is fixed. Whether it's faster depends on the exact scenario, usually it would be. But it would certainly use less memory. |
this is fixed already, will be merged into master soon and ready for next release for what it is worth - i was able to reproduce only when running with more contexts |
Hi all,
I was trying to use openpyxl to create some Excel sheets and got a HostException (which is an NPE):
Reproduction available here (just run with
./gradlew test
- on Linux, pyexpat is not implemented on Windows):https://github.com/jord1e/poc-gradle-openpyxl-error
CI/CD run with error:
https://github.com/jord1e/poc-gradle-openpyxl-error/actions/runs/11363466654
Diff that creates the error
I am using the new GraalPy Gradle plugin (
org.graalvm.python
) andGraalPyResources.createContext()
as described onhttps://www.graalvm.org/latest/reference-manual/python/Embedding-Build-Tools/#virtual-filesystem
I've not had time to investigate it further
Maybe another side-question:
How to convert a
bytes
(which is an unsigned byte array in Python) directly to abyte[]
in Java? At the moment I am just doing.as(int[].class)
and manually looping through it :)The text was updated successfully, but these errors were encountered: