ironpython

How to get lxml working under IronPython?

百般思念 提交于 2020-01-03 10:55:19
问题 I need to port some code that relies heavily on lxml from a CPython application to IronPython. lxml is very Pythonic and I would like to keep using it under IronPython, but it depends on libxslt and libxml2, which are C extensions. Does anyone know of a workaround to allow lxml under IronPython or a version of lxml that doesn't have those C-extension dependencies? 回答1: You might check out IronClad, which is an open source project intended to make C Extensions for Python available in

Playing audio in jupyter, in a for loop

▼魔方 西西 提交于 2020-01-03 03:49:07
问题 I have a ton of training data I need annotated, in order to do so I need to listen through a bunch of sound snippets and note what I hear. I wrote a small script for this in a notebook. My main issue is that IPython display dosent show in loops. As an example: import numpy import IPython.display as ipd sr = 22050# sample rate T = 2.0# seconds t = numpy.linspace(0, T, int(T*sr), endpoint=False)# time variable x = 0.5*numpy.sin(2*numpy.pi*440*t) ipd.Audio(x, rate=sr) will show up with an audio

Using python files with libraries in Visual Studio

杀马特。学长 韩版系。学妹 提交于 2020-01-03 00:53:08
问题 I want to use some python files in a Visual Studio WPF application, using this code. var ipy = Python.CreateRuntime(); dynamic test = ipy.UseFile("Test.py"); string whatever = test.pythonString() MessageBox.Show(whatever); where Test.py looks like this: def pythonString: return "Whatever" everything works as expected but if I add any import like from moviepy.editor import * to the python code the messagebox doesn't appear. Why does this happen and what do I have to change in order to make

IronPython db-api 2.0

本小妞迷上赌 提交于 2020-01-02 15:25:28
问题 Does anyone know which if any db-api 2.0 drivers work with IronPython? If so, has anyone tried using it with SQLAlchemy, SQLObject or the Django ORM? 回答1: I know this is a very late answer, but I only saw the question today -- so I am answering it today. http://sourceforge.net/projects/adodbapi contains a fully compliant db-api-2 module which works with IronPython. It is restricted to use in Windows, since it uses classic ADO, using COM calls, rather than ADO.NET. [I tried a true .NET version

Import scikit in C# application

廉价感情. 提交于 2020-01-01 19:11:09
问题 I am trying to import scikit-learn in a C# (console) application. I am using Python Tools for Visual Studio and IronPython 2.7.3. I managed to run an external python script and I also managed to import numpy by declaring the python path: "C:\Python27\Lib\site-packages\" However, when it comes to scikit-learn I get an error message: Oops! We couldn't execute the script because of an exception: No module named _c heck_build _______________________________________________________________________

How do I bind to a ListBox in IronPython?

别等时光非礼了梦想. 提交于 2020-01-01 14:37:37
问题 I am just starting out using IronPython with WPF and I don't quiet understand how binding is supposed to be done. Normally in WPF I would just do something like this: <ListBox Name="MyListBox"> <ListBox.Resources> <Style TargetType="ListBoxItem"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> <DockPanel> <TextBlock Text="{Binding Path=From}" /> <TextBlock Text="{Binding Path=Subject}" /> </DockPanel> </DataTemplate> </Setter.Value> </Setter> </Style> </ListBox.Resources> <

Python equivalent to C#'s using statement [duplicate]

北慕城南 提交于 2020-01-01 10:03:24
问题 This question already has answers here : Closed 9 years ago . Possible Duplicate: What is the equivalent of the C# “using” block in IronPython? I'm writing some IronPython using some disposable .NET objects, and wondering whether there is a nice "pythonic" way of doing this. Currently I have a bunch of finally statements (and I suppose there should be checks for None in each of them too - or will the variable not even exist if the constructor fails?) def Save(self): filename = "record.txt"

What IronPython IDE should I use?

孤人 提交于 2020-01-01 04:29:12
问题 This question probably looks a lot like IDE for ironpython on windows question here on stackoverflow. But I read the answers on that question I still have no idea what IDE I should use. What I'm looking for is to know pros and cons of a specific IDE. I recently started learning IronPython. The only IDE I used so far is IronPython Studio that integrates with Visual Studio. It was a logical choice for me because I use Visual Studio when I work with C#. One of the problem I have with IronPython

How do you implement an interface in IronPython?

本小妞迷上赌 提交于 2020-01-01 02:26:29
问题 The FAQ that comes with IronPython 2.0.1 says the following: You can define interfaces in C#, build those into a DLL, and then implement those interfaces in Python code as well as pass the python objects that implement the interfaces to C# code. I have googled and googled and googled, but haven't found how to do this. Can someone help? 回答1: I'm not sure of this, but it looks like you could do it with the regular inheritance syntax of python: class SomeClass (ISomeInterface): def SomeMethod

C# 4.0: casting dynamic to static

落爺英雄遲暮 提交于 2019-12-31 21:22:09
问题 This is an offshoot question that's related to another I asked here. I'm splitting it off because it's really a sub-question: I'm having difficulties casting an object of type dynamic to another (known) static type. I have an ironPython script that is doing this: import clr clr.AddReference("System") from System import * def GetBclUri(): return Uri("http://google.com") note that it's simply newing up a BCL System.Uri type and returning it . So I know the static type of the returned object.