Skip to content

Instantly share code, notes, and snippets.

@MzHmO
Created June 5, 2024 08:32
Show Gist options
  • Save MzHmO/7b27ea3a735e4c6014b97ec9c135a144 to your computer and use it in GitHub Desktop.
Save MzHmO/7b27ea3a735e4c6014b97ec9c135a144 to your computer and use it in GitHub Desktop.
list loaded ironpython modules
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