Menu
  • HOME
  • TAGS

IronPython entity framwork 6 Could not find attribute where

.net,linq,entity-framework,entity-framework-6,ironpython

Found the issues; I had to use import: import clr import System clr.ImportExtensions(System.Linq) ...

Is it possible to check the syntax of a python script before running it when making use of IronPython and C#?

c#,python,ironpython

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...

ImportError: No module named wpf (in Revit environment only) - User interface

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...

Access C# Enums and Classes from other namespaces in IronPython

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 ...

Call a Python function with multiple return values from C#

c#,ironpython

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...

How can I speed up this IronPython code that generates a string of arbitrary size

c#,python,string,performance,ironpython

You can use file.write('0'.zfill(size)) ...

How do I enable Frames by default in IronPython 2.7.5?

ironpython

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.

IronPython 2.7 with NetworkX 1.8.1

python,ironpython,networkx

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....

Calling .Net function from IronPython [VS2012]

.net,arrays,ironpython

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) ...

Running C# Executable From Iron Python

c#,.net,exe,ironpython

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...

Using .NET from within Python on win32? Is python.net viable?

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,...

Charting with IronPython

charts,ironpython

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....

IronPython strange method calling

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...

Check if Last Character in a String is Not a Letter

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...

Ironpython issue with import hook subpackage/submodule

ironpython

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...

PythonNet FileNotFoundException: Unable to find assembly

python,python-2.7,ironpython

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" ...

Spotfire Export Automatically

python,ironpython,spotfire

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...

Failure to install ndg-httpsclient or maybe I'm doing the solution wrong

python,wpf,ironpython

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?...

What does “Debug any CPU” in Visual Studio 2013 Express for the Web when using IronPython mean?

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...

unsupported operand type(s) for -: 'indexer#' and 'indexer#'

vb.net,ironpython

IronPython probably doesn't support parameterized properties with default values. Please open an issue with an example VB class.

How do I pass arguments to a Python script with IronPython

c#,python,ironpython

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...

Set Spotfire Graph Axis Range Programatically

ironpython,spotfire

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...

Passing lists from IronPython to C# (2)

c#,ironpython

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 module imports Visual Studio

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.

IronPython set property value on creating instance (Like c#)

c#,.net,ironpython

Yes, it is possible. IronPython supports keyword arguments in constructor calls, and these will be mapped to property assignments: param = SqlParameter(Value = "123", ...) ...

Integration of python in C# Application

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.

Python integer unexpected results [duplicate]

python,integer,ironpython

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...

How to remove last char from string in IronPyhon?

ironpython

somestring[:-1] is a correct answer also for IronPython

save workbook with openpyxl in 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...

How to export multiple arrays from IronPython to CSV

python,csv,ironpython

Try this: for i in range(0, 1024): writer.writerow([iData[i], qData[i]]) ...

Passing Arguments to Python Script C# Ironpython

c#,python,ironpython

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...

Setting field in IronPython resulting in None value

c#,python,.net,ironpython

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) ...

Spotfire IronPython script: Delete a data-table

ironpython,spotfire

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# thread running python script

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

Illegal Characters in Path C# to Ironpython

c#,python,ironpython,filepath

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...

chunk of data into fixed lengths chunks and then add a space and again add them all as a string

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]) ...

Python in C# UnboundNameException

c#,python,ironpython

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); ...

Python to C# StongBox[Single]

c#,python,ironpython

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...

Reading the contents of Microsoft Visio (2010) doc in IronPython

ironpython,visio

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 + " '"...

Ironpython in C# Import Module Error import csv module

c#,python,csv,ironpython

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...

Unable to use skype4py in iron python

c#,python,.net,wpf,ironpython

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...

Embedding IronPython's stdlib in VS extension

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...

Compile IronPython with Mono

c#,mono,ironpython

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...

import error of matplotlib with IronPython

python,matplotlib,ironpython

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.

Ubuntu and Ironpython: What paths to add to sys.path AND how to import fcntl module?

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....

IronPython in Spotfire: Current Project Path

python,ironpython,spotfire

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....

PyCharm: Shadows built in name 'self', bug or feature?

python,class,pycharm,ironpython,self

It is a IronPython Bug It does not happen while using CPython Thanks @yole...

DLL loading (C#/IronPython/C#) in VS2012

c#,.net,dll,ironpython

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...

Call IronPython from standard Python

python,ironpython

.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...

How to solve 'Global name self is not defined'?

python,ironpython

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) ...