ironpython

IronPython compile() does not accept AST object

房东的猫 提交于 2019-12-14 03:59:38
问题 In the documentation it says, 'source' can be either str or AST object When trying to compile my ast root: dl = compile(newRoot, '<string>', 'eval') I get this Exception: expected str, got Module I am using the last version of IronPython. Is there an idea why this does not work? all the examples I found seem to do it this way with no issues. Is there a workaround to compile an AST object? Thanks!!!! PD: I found this issue but seems to have no activity: http://ironpython.codeplex.com/workitem

A way to run an infinite loop without the stackoverflowexception on ironpython?

安稳与你 提交于 2019-12-13 18:46:04
问题 I'm having a little problem when trying to run an infinite loop in ironpython 2.7 Here is my script: import urllib import urllib2 import json a=0 info = '' def getInfo(): url = 'https://api.bitfinex.com/v1/pubticker/btcusd' values = {} data = urllib.urlencode(values) req = urllib2.Request(url) response = urllib2.urlopen(req) the_page = response.read() page_info = json.loads(the_page) return(page_info) while 1: try: info = getInfo() a=a+1 print("--"+str(a)+"--") if info != '': print(str(info[

How can I fix missing IronPython project templates in Visual Studio 2010?

馋奶兔 提交于 2019-12-13 18:20:04
问题 I installed IronPython yesterday. After running Visual Studio the IronPython project template showed up but later it was gone. I've tried repairing, uninstalling, and reinstalling without fixing the issue. How can I make the templates show up? 回答1: I had a similar issue with IronPython 2.7 RTM on VS 2010 SP1. I had the python tools for VS 1.0 installed before I installed IronPython. I did the following to resolve the issue Uninstalled IronPython Uninstalled Python tools for VS Installed

Spotfire IronPython script: Delete a data-table

不问归期 提交于 2019-12-13 16:54:48
问题 I am new to iron-python. I would be obliged if anyone can tell me how to completely delete a data-table using iron-python? 回答1: you can do this pretty easily with: dt_name = "Data Table" # name of the data table dt = Document.Data.Tables[dt_name] Document.Data.Tables.Remove(dt) of course you can compress this all to: Document.Data.Tables.Remove(Document.Data.Tables["Data Table"]) 来源: https://stackoverflow.com/questions/29891173/spotfire-ironpython-script-delete-a-data-table

IronPython overload resolution on generic types

时光怂恿深爱的人放手 提交于 2019-12-13 13:04:46
问题 I have a C# class with overloaded static methods like these: // Added to the Simple class in Tutorial\Extend\csextend.cs public static int Foo(IEnumerable<int> values) { return 1; } public static int Foo(IEnumerable<string> values) { return 2; } I get an error when I try to call these from IronPython 2.6. I am passing a python list that contains strings. import clr clr.AddReferenceToFile("csextend.dll") import Simple Simple.Foo(["alpha", "bravo", "charlie"]) TypeError: Multiple targets could

datatable sorting in iron python?

做~自己de王妃 提交于 2019-12-13 03:57:17
问题 I have a dtdtable in iron python dttable = handler.GetDataTable(); I tired to create a dataview for the above table by v=dttable.defaultview so how do i sort this dttable using iron python ? 回答1: dv = dttable.DefaultView dv.Sort="TOP ASC" dttable = dv.ToTable() I used the above lines to sort a data table in iron python and It worked fine ."Top" is the column name , and ASC is to sort the table in ascending order 来源: https://stackoverflow.com/questions/12178612/datatable-sorting-in-iron-python

How to reference an assembly which is built against version 'v2.0.xxx' of the runtime in IronPython 2.7?

无人久伴 提交于 2019-12-13 03:39:53
问题 I am trying to create wrapper for an assembly (thirdPartyDLL) which was built against version 'v2.0.50727' of the runtime. But whenever I try to reference it in IronPython code, it always results in following error IOError: System.IO.FileLoadException: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. My wrapper is a Class Library only, so there is no app.config or app.exe.config. I

Python: Possible to make attribute access strictly private?

我是研究僧i 提交于 2019-12-13 03:26:30
问题 If I have a class that contains a dictionary that I need to reuse among various instance methods, but I want to make that dictionary only writable from a specific instance method, is that possible? In this code: class GoodClass: def __init__(self): # name mangling enabled! self.__dict = {} def __repr__(self): return str(self.__dict) def add_to_dict(self, key, item): # this should be the only method that can write to self.__dict try: self.__dict[key] += [item] except KeyError: self.__dict[key]

Debug Iron Python from c# using Visual Studio

南笙酒味 提交于 2019-12-13 00:30:08
问题 I am calling iron python from c# by creating Python enginer and executing the script from a file. Dictionary<string, object> options = new Dictionary<string, object>(); options["Debug"] = true; m_engine = Python.CreateEngine(options); I have set the options Debug to true in the engine.Here the breakpoints are working,but I am unable to see the values of the variables in watch Can anyone give solution for this? 来源: https://stackoverflow.com/questions/29300175/debug-iron-python-from-c-sharp

IronPython - How do I import Gzip?

我们两清 提交于 2019-12-13 00:23:13
问题 I am trying to use IronPython under VS 2010. I need Gzip, but there is no (that I can find) documentation to tell me how to "reference" or add a module. Can anyone tell how to add Gzip please. 回答1: First off, IronPython does not include the gzip module because it's not supported out of the box. You can pull a copy from the Python source tree or from http://bitbucket.org/jdhardy/ironpythonzlib/src/tip/tests/gzip.py. Put this file in the Lib folder of your IronPython installation. Next, you