Issue #19771: Omit irrelevant message if package could not be initialized
diff --git a/Lib/runpy.py b/Lib/runpy.py
index c98af19..af6205d 100644
--- a/Lib/runpy.py
+++ b/Lib/runpy.py
@@ -132,6 +132,8 @@
             pkg_main_name = mod_name + ".__main__"
             return _get_module_details(pkg_main_name, error)
         except error as e:
+            if mod_name not in sys.modules:
+                raise  # No module loaded; being a package is irrelevant
             raise error(("%s; %r is a package and cannot " +
                                "be directly executed") %(e, mod_name))
     loader = spec.loader