Skip to content

Commit 5f95018

Browse files
committed
fixed loading of embedded resource "clr.py"
1 parent eec5c37 commit 5f95018

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/runtime/pythonengine.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,13 @@ public static void Initialize(IEnumerable<string> args, bool setSysArgv = true,
205205
Runtime.PyDict_SetItemString(module_globals, "__builtins__", builtins);
206206

207207
Assembly assembly = Assembly.GetExecutingAssembly();
208-
//using (Stream stream = assembly.GetManifestResourceStream("clr.py"))
209-
//using (var reader = new StreamReader(stream))
208+
// use this to check what the correct path to the resource is:
209+
//string[] names = assembly.GetManifestResourceNames();
210+
using (Stream stream = assembly.GetManifestResourceStream("Python.Runtime.resources.clr.py"))
211+
using (var reader = new StreamReader(stream))
210212
{
211213
// add the contents of clr.py to the module
212-
//string clr_py = reader.ReadToEnd();
213-
string clr_py = File.ReadAllText("clr.py");
214+
string clr_py = reader.ReadToEnd();
214215
Exec(clr_py, module_globals, locals.Handle);
215216
}
216217

0 commit comments

Comments
 (0)