ironpython

Embedding IronPython - Can't add reference to System

◇◆丶佛笑我妖孽 提交于 2019-12-01 07:55:06
I'm embedding IronPython in my C# application. For some reason I'm having trouble loading assemblies. Specifically, I want System.dll so I can have access to .NET classes like DateTime. If I try the line: _runtime.LoadAssembly(_runtime.Host.PlatformAdaptationLayer.LoadAssembly("System")); I get: could not load file or assembly 'System' If I explicitly type the path to C:/WINDOWS/Microsoft.NET/.../System.dll I get: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) So then I tried doing the import using clr inside the Python script: import clr clr.AddReference

trouble executing Selenium python unittests in C# with ScriptEngine (.NET 3.5)

霸气de小男生 提交于 2019-12-01 06:37:42
first time poster. I'm turning to my first question on stack overflow because I've found little resources in trying to find an answer. I'm looking to execute Selenium python tests from a C# application. I don't want to have to compile the C# Selenium tests each time; I want to take advantage of IronPython scripting for dynamic selenium testing. (note: I have little Python or ScriptEngine, et al experience.) Selenium outputs unit tests in python in the following form: from selenium import selenium import unittest class TestBlah(unittest.TestCase): def setUp(self): self.selenium = selenium(...)

Embedding IronPython - Can't add reference to System

拈花ヽ惹草 提交于 2019-12-01 06:36:26
问题 I'm embedding IronPython in my C# application. For some reason I'm having trouble loading assemblies. Specifically, I want System.dll so I can have access to .NET classes like DateTime. If I try the line: _runtime.LoadAssembly(_runtime.Host.PlatformAdaptationLayer.LoadAssembly("System")); I get: could not load file or assembly 'System' If I explicitly type the path to C:/WINDOWS/Microsoft.NET/.../System.dll I get: The given assembly name or codebase was invalid. (Exception from HRESULT:

.net framework with scrapy python [closed]

痴心易碎 提交于 2019-12-01 06:34:46
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . Is it possible to use .NET framework with the Python scrapy framework to scrape data from different sites? I am working on my final year project in which I want to use C# as front end language and Python for scraping the data. 回答1: I don't think it is possible, because Scrapy uses

trouble executing Selenium python unittests in C# with ScriptEngine (.NET 3.5)

人走茶凉 提交于 2019-12-01 05:40:18
问题 first time poster. I'm turning to my first question on stack overflow because I've found little resources in trying to find an answer. I'm looking to execute Selenium python tests from a C# application. I don't want to have to compile the C# Selenium tests each time; I want to take advantage of IronPython scripting for dynamic selenium testing. (note: I have little Python or ScriptEngine, et al experience.) Selenium outputs unit tests in python in the following form: from selenium import

IronPython cannot import module os

烂漫一生 提交于 2019-11-30 23:50:01
So I have a basic ZIPPED IronPython (2.6 or 2.6.1) that I just unzip, start ipy.exe, type "import os" and hit enter. The following output happens: Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named os It doesn't work even if I import clr first. What's it to be done ? I've googled this issue but no relevant answer. The closest idea was this (which didn't work): import clr clr.AddReference("IronPython") clr.AddReference("IronPython.Modules") import os Likely, the problem is not the in zip, but in os module location. You need to have CPython

IronPython ImportException: No module named logging

只愿长相守 提交于 2019-11-30 21:38:15
I got ironpython working fine on mono, but it doesn't import the logging module. Executing this code: ScriptEngine engine = Python.CreateEngine(); dynamic logging = engine.ImportModule("logging"); yields the following error: IronPython.Runtime.Exceptions.ImportException: No module named logging The IronPython assemblies I have included are up-to-date: IronPython.Modules.dll, Microsoft.Dynamic.dll, Microsoft.Scripting.dll, Microsoft.Scripting.Metadata.dll. How can I make use of the logging module within Ironpython? It's not enough to add the assemblies to your C# application. logging is written

Can i use all standard Python libraries with IronPython or

懵懂的女人 提交于 2019-11-30 19:34:56
... does it requires some sort of wrappers? I was under expression that IronPython is a .NET implementation of the Python which somehow magically enables applications built with IronPython to use standard Python libraries (which I believe either a raw .py sources or .py source packaged into the eggs), but when I was reading http://www.doughellmann.com/PyMOTW/hashlib/index.html at the bottom of the page I spotted: "A wrapper for hashlib that works with IronPython." which immediately put me on guard... It depends: If a library module is implemented in pure python, it is likely to work. A library

Writing an Iron Python debugger

一笑奈何 提交于 2019-11-30 19:34:43
As a learning exercise I'm writing myself a simple extension / plugin / macro framework using IronPython - I've gotten the basics working but I'd like to add some basic debugging support to make my script editor easier to work with. I've been hunting around on the internet a bit and I've found a couple of good resources on writing managed debuggers (including Mike Stall's excellent .Net Debugging blog and the MSDN documentaiton on the CLR Debugging API ) - I understand that IronPython is essentially IL however apart from that I'm a tad lost on how to get started, in particular: Are there any

Using SQL Alchemy and pyodbc with IronPython 2.6.1

☆樱花仙子☆ 提交于 2019-11-30 16:40:17
I'm using IronPython and the clr module to retrieve SQL Server information via SMO. I'd like to retrieve/store this data in a SQL Server database using SQL Alchemy, but am having some trouble loading the pyodbc module. Here's the setup: IronPython 2.6.1 (installed at D:\Program Files\IronPython) CPython 2.6.5 (installed at D:\Python26) SQL Alchemy 0.6.1 (installed at D:\Python26\Lib\site-packages\sqlalchemy) pyodbc 2.1.7 (installed at D:\Python26\Lib\site-packages) I have these entries in the IronPython site.py to import CPython standard and third-party libraries: # Add CPython standard libs