Created
June 5, 2024 08:32
-
-
Save MzHmO/7b27ea3a735e4c6014b97ec9c135a144 to your computer and use it in GitHub Desktop.
list loaded ironpython modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using IronPython.Hosting; | |
using Microsoft.Scripting.Hosting; | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var engine = Python.CreateEngine(); | |
var pythonScript = @" | |
import sys | |
def list_installed_modules(): | |
installed_modules = sorted(sys.builtin_module_names) | |
print('Installed modules:') | |
for module in installed_modules: | |
print(f' - {module}') | |
list_installed_modules() | |
"; | |
engine.Execute(pythonScript); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment