.net,linq,entity-framework,entity-framework-6,ironpython
Found the issues; I had to use import: import clr import System clr.ImportExtensions(System.Linq) ...
The solution I made is shown where I originally asked my question. Since I solved my own issue and posted the solution here I can say this is the answer to the question. Thanks again to Pawel Jasinski! :-) Baikuriu also thanks for giving the hint to check for the...
ironpython,revit-api,revitpythonshell
I wonder... could it have to do with the search paths? I tried doing this in the ironpython console: import wpf wpf.__file__ but got no result, so I checked the filesystem for some other places the module could come from. So I did this: Add a search path to: "C:\Program...
c#,.net,enums,namespaces,ironpython
You need to import your assembly: import clr clr.AddReference("assembly_name") from EnumTest import EnumTest from EnumTest.EnumTest import FooEnum ...
The IronPython runtime provides the result of get_xyz() as a PythonTuple which means it can be used as IList, ICollection, IEnumerable<object> ... Because of the primarily static nature of C# there are no syntax constructs similar to python's way of unpacking tuples. Through the provided interfaces and collection APIs you...
c#,python,string,performance,ironpython
You can use file.write('0'.zfill(size)) ...
Unfortunately there's no way to do that right now. One possible option would be a IRONPYTHONOPTS environment variable, but that would have to wait for 2.7.6. IronPython 3 will make -X:FullFrames the default and provide -X:NoFrames instead.
This appears to be a bug in IronPython - types.FunctionType resolves to a constructor call that throws a NotImplementedException (see https://github.com/IronLanguages/main/blob/master/Languages/IronPython/IronPython/Runtime/PythonFunction.cs#L72). It's old code, so I'm not sure why it does that. I've opened issue #35180 to track it....
You can pass an array of floats (which are System.Single) like this: iData = System.Array[System.Single]([1.0, 2.0, 3.0]) qData = System.Array[System.Single]([4.0, 5.0, 6.0]) GetData(numSamples, iData, qData) EDIT: In case you would like to preallocate array and have no actual python content, use: iData = System.Array.CreateInstance(System.Single, 1024) ...
It's worth noting that IronPython and Python are not the same thing. IronPython is built on the .NET framework and so should subscribe to all the usual features of .NET (like cross-compatibility, similar to C# and VB.NET code being able to interact). I believe that this is the general concept...
python,.net,windows,ironpython,python.net
If you're looking for a Python variant that plays very well with .NET, then I highly suggest Iron Python: http://ironpython.net/ it is an open-source variant of Python that was integrated with the .NET framework, allowing it to behave similarly to one of the .NET-friendly languages. As far as being active,...
OxyPlot is a modern cross-platform plotting library for .NET. It is published under the MIT license and can therefore be used in commercial projects. It supports lots of chart types, provides examples and documentation and is under active development....
list,methods,call,instance,ironpython
This is true of normal Python classes as well: class Foo(object): def bar(self): pass f = Foo f.bar(Foo()) It's the difference between bound (Foo().bar) and unbound (Foo.bar) methods. It's not so much a feature as a side effect of how methods are implemented in Python. Contains is always false because...
python,regex,string,ironpython
Just invert your method - rather than removing the last character if it is a number, remove it if it isn't a letter: >>> start = "A_Origin1_1" >>> while start and not start[-1].isalpha(): start = start[:-1] >>> start 'A_Origin' Note that including start in the while test ensures that empty...
After some additional troubleshooting I think this was mostly operator error. It apears CPython is slightly more forgiving in terms of a module's path attribute. If the above code is changed so that mod.__path__ = r"C:\not\a\real\path\baz" Looks like mod.__path__ = [r"C:\not\a\real\path\baz",] Everything works fine as is. If someone is motivated...
It turns out that even though I added the path through sys.path.insert(0,"C:\\dev\\proj_1\\") it still couldn't find the file because the .dll because Windows was not enabling it to load from "external sources". To fix this: Right-click on the .dll "Properties" Under "General", click "Unblock" ...
You can utilize JavaScript to click a button on load and have that button be your python script. Like so: window.onload = function callButtonClickEvent(){ document.getElementById('YOUR_SPOTFIRE_CONTROL_ID').click(); } By clicking "edit HTML" in the text box you're using you can see the ID spotfire has assigned your button. The above code will...
If you read the fine print, ndg-httpsclient is incompatible with Python 3, as it was developed for Python2.7 . That's probabably the root cause. RE: Why is Python 3.0 not backward compatible?...
python,visual-studio-2013,ironpython
"Debug Any CPU" is the build mode that's set. Debug means non-optimized so that a debugging session will show operations in the proper order, the opposite is Release. Any CPU means that the code isn't compiled directly to CPU instructions but goes to an intermediate code, so it can be...
IronPython probably doesn't support parameterized properties with default values. Please open an issue with an example VB class.
Thank you all for pointing me in the correct direction. For some reason engine.sys seems to no longer work for more recent versions of IronPython so instead GetSysModule must be used. Here is the revised version of my code that allows me to alter argv: using System; using System.Collections; using...
I found an automated solution, and you can either set it to use zoom sliders or not. You have to input the StartDate and EndDate properties as Script parameters, and you also have to enter every visualization as a Script parameter (so I needed 5 total for my script). The...
OK I found it. The type is indeed IronPython.Runtime.ListGenericWrapper<double> but the Python code above returns a list of ints. If I change the constructor to self.a = 5.0 the thing works.
python,visual-studio-2013,ironpython,openpyxl
openpyxl does not work with IronPython. But that should not affect using it with VisualStudio. Presumably you need to set the path for the project.
Yes, it is possible. IronPython supports keyword arguments in constructor calls, and these will be mapped to property assignments: param = SqlParameter(Value = "123", ...) ...
c#,python,ironpython,python.net
IronPython is what you want. It compiles to .NET bytecode. You can reasonably easily call python code from another .NET language (and the other way around). IronPython is supported in Visual Studio too, I think.
You got 11.9999999999999982 ! If you add the following line to your code, you'll get an amazing result print "%.16f" % n Output 11.9999999999999982 How to solve You may want to try this: from decimal import Decimal k=Decimal(12.0) print int(k) #prints 12 This will convert 12.0 (a float) to a...
somestring[:-1] is a correct answer also for IronPython
python,excel,ironpython,openpyxl
If looks like you're using part of the CPython stdlib: File "C:\Python27\Lib\xml\sax\saxutils.py", line 165, in startElementNS def startElementNS(self, name, qname, attrs): File "C:\Python27\Lib\xml\sax\saxutils.py", line 102, in write def write(self, s): TypeError: expected long, got NoneType IronPython's stdlib is slightly different. When running under the interpreter it's probably picking up the...
Try this: for i in range(0, 1024): writer.writerow([iData[i], qData[i]]) ...
Quoting values to put them into generated code can be tricky to get your head around. The string you're building to execute doesn't quote the filename string in the Python code. The Python interpreter is seeing: x = C:\blah\blah + profile-value So it's complaining about the colon. It needs to...
I resolved it because actually, the instance I had to call in MyClass.Parameters.anIntValue.SetValue(instance,value) was not : MyClass.Parameters.anIntValue.SetValue(obj.anIntValue,8) but rather : MyClass.Parameters.anIntValue.SetValue(obj,8) ...
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"]) ...
c#,.net,multithreading,ironpython
Yes, IronPython can be use for this purpose. See http://blogs.msdn.com/b/charlie/archive/2009/10/25/hosting-ironpython-in-a-c-4-0-program.aspx for details on running a script from from .Net
In the screenshot with your variables ["outFileName"] is displayed as containing "c:\\Temp\tmp.csv" so instead of the second backslash (before tmp.csv) it contains a tab chararcter...
regex,list,join,ironpython,findall
You can simply do x="a85b080040010000" print re.sub(r"(.{2})",r"\1 ",x) or x="a85b080040010000" print " ".join([i for i in re.split(r"(.{2})",x) if i]) ...
Didn't have the syntax for setting the scope right. IDictionary<string, object> options = new Dictionary<string, object>(); options["Argument"] = new[] { filePath, profile }; var pyEngine = Python.CreateEngine(options); var pyScope = pyEngine.CreateScope(); string script = "xccdf-xml2tsv.py"; pyScope.SetVariable(profile, options); pyEngine.ExecuteFile(script, pyScope); ...
In order to have a proper target for the out parameter you have to explicitly create a clr reference (StrongBox serves as that reference/value wrapper) in IronPython, as there is no out keyword on the caller side (like in C#) that would allow you to do so. This could look...
You could start with something like this... it's pretty straightforward I suppose.. ....... ....... page = visapp.ActivePage for shape in page.Shapes: if not shape.OneD: print shape.Name + " '" + shape.Text + "'" for connectedShapeId in shape.ConnectedShapes(2, ""): connectedShape = page.Shapes.ItemFromID[connectedShapeId] print " => " + connectedShape.Name + " '"...
The IronPython engine you created is unaware of the standard library implementation it should use. You can specify it by adding something like var paths = pyEngine.GetSearchPaths(); paths.Add(@"C:\Program Files (x86)\IronPython 2.7\Lib"); pyEngine.SetSearchPaths(paths); You could either point it to a locally installed iron python (as in my example) or use the...
Skype4Py seems to rely on dbus which is not available for IronPython right now. There are efforts to implement the standard dbus python module using DBusSharp IronPython API to implement current dbus-python API with managed D-Bus but there is no indication if or when that will happen. You could move...
c#,visual-studio-2013,ironpython,vsix
I would presume that there is a way to include them in the VSIX file and also know where they are on disk - at least, you could use AppDomain.CurrentDomain.GetAssemblies() for find the IronPython assembly and Assembly.Location to find where it is, and hope the VSIX puts the Lib directory...
I'm no expert on either IronPython or Mono, but out of curiosity I just tried this. For whatever reason, the IPV6Only value in the SocketOptionName enum appears to be missing in the Mono implementation. The error message you're getting is from the code in IronPython.Module/Socket.cs attempting to reference this. It...
Unfortunately, IronPython does not support CPython .pyd files. The IronClad project attempted to do so but updating it to work with the latest IronPython and CPython would likely be an enormous undertaking.
python-2.7,ubuntu,mono,ironpython,fcntl
As far as I can see, the fcntl module of cPython is a builtin module (implemented in C) - those modules need to be explicitly implemented for most alternative Python interpreters like IronPython (in contrast to the modules implemented in plain Python), as they cannot natively load Python C extensions....
The script below should help you with this. There are 2 ways to get the path of the analysis depending on if you are using a library file or a .dxp. Your specific question is for .dxp but for the sake of passing knowledge on I figured I'd mention it....
python,class,pycharm,ironpython,self
It is a IronPython Bug It does not happen while using CPython Thanks @yole...
You can try replicating what "works for me". Create a solution containing: python project (ironpython) C# project Add a reference to desired oracle library (Oracle.DataAccess.dll) to C# project using the standard VS mechanism. C# project should also contains a post build step to copy the resulting dll and pdb into...
.NET DLLs are not the same as C DLLs (which you can use via ctypes). You can, however, use the Python.NET library to call the function like this: import clr # Imports Python.Runtime.dll import foo # Imports foo.dll foo.foo() I don't know what you mean by "latest CLR which Python...
You did not include self in your declaration for method notify in class WinWash: def notify(event, message): ''' Send message to user. ''' app = 'WinWash' self.notifier(app, event, message) should be : def notify(self, event, message): ''' Send message to user. ''' app = 'WinWash' self.notifier(app, event, message) ...