ironpython

Loading numpy into IronPython

南楼画角 提交于 2020-01-23 12:19:56
问题 I've recently installed Ironpython + tools and having trouble loading external modules (numpy). this is my test code: import numpy numpy.test() when writing my simple test, intellisense can find numpy, however when it's run from vs2010, I get: ImportException was unhandled by user code: No module named numpy IronPython Console output (shortened): numpy\__init__.py line 141 numpy\add_newdocs.py line 9 numpy\lib\__init__.py line 4 numpy\lib\type_check.py line 8 numpy\core\__init__.py line 5

Is there a Python equivalent to the C# ?. and ?? operators?

℡╲_俬逩灬. 提交于 2020-01-21 04:26:09
问题 For instance, in C# (starting with v6) I can say: mass = (vehicle?.Mass / 10) ?? 150; to set mass to a tenth of the vehicle's mass if there is a vehicle, but 150 if the vehicle is null (or has a null mass, if the Mass property is of a nullable type). Is there an equivalent construction in Python (specifically IronPython) that I can use in scripts for my C# app? This would be particularly useful for displaying defaults for values that can be modified by other values - for instance, I might

Assembly redirection in code instead of app.config

℡╲_俬逩灬. 提交于 2020-01-17 07:36:27
问题 I'm using ironruby to execute a script that loads an assembly with a dependency that needs to be redirected from v2.0.0.0 to v3.5.0.0 in the app.config like this: <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="3.5.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name=

How do I install keras package in IronPython/VS2010?

天涯浪子 提交于 2020-01-17 06:00:17
问题 I get an error when trying to install keras: Installing 'keras' Unhandled exception: Traceback (most recent call last): File "C:\Program Files (x86)\IronPython 2.7\Lib\runpy.py", line 170, in run_module File "C:\Program Files (x86)\IronPython 2.7\Lib\runpy.py", line 101, in _get_module_details File "C:\Program Files (x86)\IronPython 2.7\Lib\pkgutil.py", line 456, in get_loader File "C:\Program Files (x86)\IronPython 2.7\Lib\pkgutil.py", line 466, in find_loader File "C:\Program Files (x86)

__import__ vs imp.load_module

夙愿已清 提交于 2020-01-14 10:04:10
问题 I got an error while trying to install autopep8 with ironpython: ImportError: No module named logilab The code snippet it failed is: def load_module(self, fullname): self._reopen() try: mod = imp.load_module(fullname, self.file, self.filename, self.etc) finally: if self.file: self.file.close() # Note: we don't set __loader__ because we want the module to look # normal; i.e. this is just a wrapper for standard import machinery return mod using the interpreter ipy64 importing logilab did not

Which IDE do I use to develop a mono app in IronPython? [closed]

戏子无情 提交于 2020-01-14 03:08:49
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I'm investigating which platform to use for a cross platform GUI app that needs access to the serial port. Currently I'm thinking on using the mono runtime and monodevelop as the IDE. However, I already have a corpus of prototype code written python. Therefore, my idea was to write the mono app in IronPython as

Calling a .Net function in Python which has a reference parameter

随声附和 提交于 2020-01-13 10:17:10
问题 I'm using IronPython in VS2012 and trying to call a .Net function which takes in a Ref parameter, Lib.dll public int GetValue(ref double value) { ... } Python: import clr clr.AddReference('Lib.dll') from LibDll import * value =0.0 x = GetValue(value) am I missing something, in C# we use ref along with the variable name, what about here in Python? 回答1: There are two ways you can invoke methods with out or ref parameters from IronPython. In the first case the call is handled by automatic

IronPython ImportException: No module named logging

雨燕双飞 提交于 2020-01-11 03:06:10
问题 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

IronPython integration in C#: a specific problem/question

本小妞迷上赌 提交于 2020-01-10 03:08:45
问题 I'm working on providing an extensibility mechanism for my C# mapmaking application through IronPython. Everything works fine, but I have a specific requirement which I'm having trouble implementing: I want the user to be able to specify two things: A file name of the Python script to be loaded A one-liner string containing Python script which would typically be a call of a function from that Python file (example getTextLabel(element) ) These two settings must be separate, but I don't know if

GAC (gacutil) not working with IronPython.dll on Mono

本秂侑毒 提交于 2020-01-06 02:59:09
问题 I tried to use gacutil (mono) for IronPython, but I got the following error. sudo gacutil -i IronPython.dll Password: Failure adding assembly IronPython.dll to the cache: Strong name cannot be verified for delay-signed assembly What does this mean? Any solution to this problem? 回答1: Did you build IronPython yourself? Signing is kind of a PITA and you'll need to provide your own full key to get a real signature. We do include the MS public key in the distribution but this can only be used for