Created
August 25, 2016 15:23
-
-
Save hfoffani/95ec70063e8cc026df60976bcd48c27a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| "c:\Program Files (x86)\IronPython 2.7\ipy.exe" test957.py | |
| C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe test957.cs /reference:"c:\Program Files (x86)\IronPython 2.7\IronPython.dll" /reference:"c:\Program Files (x86)\IronPython 2.7\Microsoft.Scripting.dll" /reference:LibPy.dll | |
| test957.exe |
This file contains hidden or 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 System.Collections.Generic; | |
| using System.IO; | |
| using IronPython.Hosting; | |
| using IronPython.Runtime; | |
| namespace ConsoleApplication1 { | |
| class Program { | |
| static void Main(string[] args) { | |
| var engine = Python.CreateEngine(new Dictionary<string, object>() { { "Debug", true }, {"ExceptionDetails",true} }); | |
| engine.Runtime.LoadAssembly(typeof(System.Linq.Enumerable).Assembly); | |
| engine.Runtime.LoadAssembly(typeof(System.String).Assembly); | |
| engine.Runtime.LoadAssembly(typeof(System.Diagnostics.Process).Assembly); | |
| engine.Runtime.LoadAssembly(typeof(DLRCachedCode).Assembly); | |
| try { | |
| engine.Execute(@" | |
| import sys | |
| from os import path | |
| def f(*args): | |
| return f | |
| sys.settrace(f) | |
| path.abspath('Z:\\Documents\\ipy-issues\\issues\\LibPy.dll') | |
| def g(): pass | |
| g() | |
| "); | |
| } catch(Exception e) { | |
| Console.WriteLine(e); | |
| } | |
| Console.ReadLine(); | |
| } | |
| } | |
| } |
This file contains hidden or 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
| import os | |
| import clr | |
| basedir = 'C:\\Program Files (x86)\\IronPython 2.7\\' | |
| all_files = [] | |
| for dir, blah, files in os.walk(basedir + 'Lib'): | |
| if dir.startswith('Lib\\site-packages'): | |
| print('skipping', dir) | |
| continue | |
| for file in files: | |
| if file.endswith('.py'): | |
| if file in [ 'platform.py'] : | |
| continue | |
| all_files.append(dir + '\\' + file) | |
| clr.CompileModules('z:\\Documents\\ipy-issues\\issues\\LibPy.dll', *all_files) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment