Comments (7)
Indeed I have now found a way around this, check out this gist: https://gist.github.com/filmor/58f5099f96570c64b1d3
The implementation of the member access is done by basically translating the code that the C# compiler produces when accessing dynamic properties to Python.
Note: Strictly speaking this does not implement full support, as it only helps classes that derive from DynamicObject
, not those that only implement IDynamicMetaObjectProvider
.
from pythonnet.
@filmor what is the use case for exposing DLR types in python?
from pythonnet.
My particular use case is a configuration library that allows for constructs like:
string proxy = c.proxy.http;
where c
is a dynamic object of which the members are implicitly created by reading from the config. It allows us to pass partial configuration around easily and reduces string-littering.
from pythonnet.
@filmor can this be used to access dynamic attributes of COM objects? if yes, can you provide minimal example?
from pythonnet.
@filmor here is my first attempt at using com objects from pythonnet:
https://gist.github.com/denfromufa/ec559b5af41060c5ac318f7f59d8b415#file-excel_interop_vsto-ipynb
from pythonnet.
@filmor how would you add support for IDynamicMetaObjectProvider?
from pythonnet.
This looks really powerful library:
https://github.com/ekonbenefits/dynamitey/wiki/UsageReallyLateBinding
from pythonnet.
Related Issues (20)
- Unhandled Exception when exiting from nPython.exe (net472) HOT 1
- clr is not being imported properly HOT 2
- Python.Runtime.PythonException: ImportError: DLL load failed: 文件名或拓展名太长。
- Script not executing properly in embedded Python in .NET application HOT 3
- Getting exception when calling PythonEngine.Initialize() second time after shutdown HOT 2
- Cannot import win32api from pywin32 when running pythonnet in a c#/.NET runtime HOT 2
- PythonNET unknown kwargs being discarded
- Signal.py error in Linux HOT 1
- Failed to load 'System.Windows.Forms.dll' on .net8 HOT 1
- how to use the .net8 in python to run the C# assembly?
- Registering an encoder implemented in Python breaks the constructing of other Python-implemented encoders
- Possible bug in reading zero width no-break space character HOT 1
- Requesting Py_buffer with additional fields either crashes or returns struct with partially garbage values HOT 1
- System.ArgumentException: Illegal characters in path HOT 9
- Can't use Dictionary<int, float> and .items() together
- Can not import module of custom dll
- Cannot import tkinter in Python.Net code
- Are rich comparisons (PEP 207) implemented?
- Issue working with modules on Ubuntu 22.04 but works on Windows 11
- StackOverflowException when importing third party libraries in .NET on macOS 14.5. HOT 16
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pythonnet.