Skip to content

Commit 1b70a57

Browse files
committed
[GR-59373] Update error message on windows when failing to import C extensions.
1 parent c3e9513 commit 1b70a57

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,9 +312,6 @@ public static Object loadCExtModule(Node location, PythonContext context, Module
312312
message += " See https://www.graalvm.org/latest/reference-manual/python/Native-Extensions/#embedding-limitations for the limitations. " +
313313
"You can suppress this warning by setting the context option 'python.WarnExperimentalFeatures' to 'false'.";
314314
}
315-
if (PythonOS.getPythonOS() == PythonOS.PLATFORM_WIN32) {
316-
message += " If loading binary wheels fails, please make sure you installed the latest Microsoft Visual C++ Redistributable from https://aka.ms/vs/17/release/vc_redist.x64.exe.";
317-
}
318315
getLogger().warning(message.formatted(spec.name, spec.path));
319316
}
320317
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/ErrorMessages.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
*/
4141
package com.oracle.graal.python.nodes;
4242

43+
import com.oracle.graal.python.builtins.PythonOS;
4344
import static com.oracle.graal.python.builtins.objects.str.StringUtils.cat;
4445
import static com.oracle.graal.python.util.PythonUtils.tsLiteral;
4546

@@ -190,7 +191,9 @@ public abstract class ErrorMessages {
190191
public static final TruffleString CANNOT_IMPORT_NAME_CIRCULAR = tsLiteral("cannot import name '%s' from partially initialized module '%s' (most likely due to a circular import)");
191192
public static final TruffleString CANNOT_INITIALIZE_WITH = tsLiteral("cannot initialize %s with %s%s");
192193
public static final TruffleString CANNOT_LOAD = tsLiteral("cannot load %s: %s");
193-
public static final TruffleString CANNOT_LOAD_M = tsLiteral("cannot load %s: %m");
194+
public static final TruffleString CANNOT_LOAD_M = (PythonOS.getPythonOS() == PythonOS.PLATFORM_WIN32) ? tsLiteral(
195+
"cannot load %s: %m. Error 126 indicates missing DLLs, please make sure you have the latest Microsoft Visual C++ Redistributable from https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist.")
196+
: tsLiteral("cannot load %s: %m");
194197
public static final TruffleString CANNOT_RELEASE_UNAQUIRED_LOCK = tsLiteral("cannot release un-acquired lock");
195198
public static final TruffleString CANNOT_REENTER_TEE_ITERATOR = tsLiteral("cannot re-enter the tee iterator");
196199
public static final TruffleString CANNOT_SPECIFY_BOTH_COMMA_AND_UNDERSCORE = tsLiteral("Cannot specify both ',' and '_'.");

0 commit comments

Comments
 (0)