Skip to content

Commit e069794

Browse files
committed
provide workaround error msg if failed to load external module from VFS
1 parent 96a00fc commit e069794

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtContext.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,14 @@ public static Object loadCExtModule(Node location, PythonContext context, Module
314314
} catch (PException e) {
315315
throw e;
316316
} catch (AbstractTruffleException e) {
317+
if (!realPath.exists() && realPath.toString().contains("org.graalvm.python.vfsx")) {
318+
// file does not exist and it is from VirtualFileSystem
319+
// => we probably failed to extract it due to unconventional libs location
320+
getLogger().severe(String.format("could not load module %s (real path: %s) from virtual file system.\n\n" +
321+
"!!! Please try to run with java system property graalpy.vfs.extractOnStartup=true !!!\n", spec.path, realPath));
322+
323+
}
324+
317325
throw new ImportException(CExtContext.wrapJavaException(e, location), spec.name, spec.path, ErrorMessages.CANNOT_LOAD_M, spec.path, e);
318326
}
319327
} else {

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/utils/VirtualFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ private VirtualFileSystem(Predicate<Path> extractFilter,
364364
this.extractFilter = extractFilter;
365365
if (extractFilter != null) {
366366
try {
367-
this.extractDir = Files.createTempDirectory("vfsx");
367+
this.extractDir = Files.createTempDirectory("org.graalvm.python.vfsx");
368368
this.deleteTempDir = new DeleteTempDir(this.extractDir);
369369
Runtime.getRuntime().addShutdownHook(deleteTempDir);
370370
} catch (IOException e) {

graalpython/org.graalvm.python.embedding/src/org/graalvm/python/embedding/vfs/VirtualFileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ private VirtualFileSystem(Predicate<Path> extractFilter,
360360
this.extractFilter = extractFilter;
361361
if (extractFilter != null) {
362362
try {
363-
this.extractDir = Files.createTempDirectory("vfsx");
363+
this.extractDir = Files.createTempDirectory("org.graalvm.python.vfsx");
364364
this.deleteTempDir = new DeleteTempDir(this.extractDir);
365365
Runtime.getRuntime().addShutdownHook(deleteTempDir);
366366
} catch (IOException e) {

0 commit comments

Comments
 (0)