mdsplus
mdsplus copied to clipboard
Python can not call methods of devices written in other languages (C, TDI, JAVA
When scripting MDSplus in python, methods of devices not implemented in python can not be called.
There is a work around by calling tree.tcl('do/meth...')
I think we may be able to put something in getattribute in TreeNode to fix this. If after it fails to find a descendant or a tag it could check:
if self.record.__class_ == MDSplus.compound.Conglom :
and if so return something which calls TreeDoMethod.
There are some issues with this:
- the real properties are the last case in the routine.
- for device like things how do we distinguish device methods from real properties since we have not enquiry API to find available methods, and we do not want to actually call the method here, just return something that would call the method.
- this could be more magic syntax ?
- We need a. helper routine to return which calls TreeDoMethod
Any thoughts about this ?
Device should have a doMethod(name, *args). implementing something in getattr i would advise against. users should explicidly use doMethod
Get Outlook for Androidhttps://aka.ms/ghei36
From: Josh Stillerman [email protected] Sent: Friday, September 4, 2020 3:15:59 PM To: MDSplus/mdsplus [email protected] Cc: Subscribed [email protected] Subject: [MDSplus/mdsplus] Python can not call methods of devices written in other languages (C, TDI, JAVA (#2111)
When scripting MDSplus in python, methods of devices not implemented in python can not be called.
There is a work around by calling tree.tcl('do/meth...')
I think we may be able to put something in getattribute in TreeNode to fix this. If after it fails to find a descendant or a tag it could check:
if self.record._class == MDSplus.compound.Conglom :
and if so return something which calls TreeDoMethod.
There are some issues with this:
- the real properties are the last case in the routine.
- for device like things how do we distinguish device methods from real properties since we have not enquiry API to find available methods, and we do not want to actually call the method here, just return something that would call the method. * this could be more magic syntax ?
- We need a. helper routine to return which calls TreeDoMethod
Any thoughts about this ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMDSplus%2Fmdsplus%2Fissues%2F2111&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626133163&sdata=G%2FSc9t9Z4ZU2UNjPLgZyPS1%2FhxxubRtXG%2B%2BFn%2B%2B6WCU%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPRFLUIMNEQLSUNCLNVOSLSEDSA7ANCNFSM4QYKXKMQ&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626143159&sdata=eDTRP2FefaMaKzuV4vdjjXs5jKACGb46S3FWE9zOTTg%3D&reserved=0.
if you really want to allow node.init() for any device getattr must exclude Device subclasses and returt a dynamic callable proxy object
Get Outlook for Androidhttps://aka.ms/ghei36
From: Zack VII [email protected] Sent: Friday, September 4, 2020 3:25:51 PM To: MDSplus/mdsplus [email protected]; MDSplus/mdsplus [email protected] Cc: Subscribed [email protected] Subject: Re: [MDSplus/mdsplus] Python can not call methods of devices written in other languages (C, TDI, JAVA (#2111)
Device should have a doMethod(name, *args). implementing something in getattr i would advise against. users should explicidly use doMethod
Get Outlook for Androidhttps://aka.ms/ghei36
From: Josh Stillerman [email protected] Sent: Friday, September 4, 2020 3:15:59 PM To: MDSplus/mdsplus [email protected] Cc: Subscribed [email protected] Subject: [MDSplus/mdsplus] Python can not call methods of devices written in other languages (C, TDI, JAVA (#2111)
When scripting MDSplus in python, methods of devices not implemented in python can not be called.
There is a work around by calling tree.tcl('do/meth...')
I think we may be able to put something in getattribute in TreeNode to fix this. If after it fails to find a descendant or a tag it could check:
if self.record._class == MDSplus.compound.Conglom :
and if so return something which calls TreeDoMethod.
There are some issues with this:
- the real properties are the last case in the routine.
- for device like things how do we distinguish device methods from real properties since we have not enquiry API to find available methods, and we do not want to actually call the method here, just return something that would call the method. * this could be more magic syntax ?
- We need a. helper routine to return which calls TreeDoMethod
Any thoughts about this ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMDSplus%2Fmdsplus%2Fissues%2F2111&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626133163&sdata=G%2FSc9t9Z4ZU2UNjPLgZyPS1%2FhxxubRtXG%2B%2BFn%2B%2B6WCU%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPRFLUIMNEQLSUNCLNVOSLSEDSA7ANCNFSM4QYKXKMQ&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626143159&sdata=eDTRP2FefaMaKzuV4vdjjXs5jKACGb46S3FWE9zOTTg%3D&reserved=0.
We can discuss this at the same time we talk about device consolidation.
On 9/4/20 9:30 AM, Timo Schroeder wrote:
if you really want to allow node.init() for any device getattr must exclude Device subclasses and returt a dynamic callable proxy object
Get Outlook for Androidhttps://aka.ms/ghei36
From: Zack VII [email protected] Sent: Friday, September 4, 2020 3:25:51 PM To: MDSplus/mdsplus [email protected]; MDSplus/mdsplus [email protected] Cc: Subscribed [email protected] Subject: Re: [MDSplus/mdsplus] Python can not call methods of devices written in other languages (C, TDI, JAVA (#2111)
Device should have a doMethod(name, *args). implementing something in getattr i would advise against. users should explicidly use doMethod
Get Outlook for Androidhttps://aka.ms/ghei36
From: Josh Stillerman [email protected] Sent: Friday, September 4, 2020 3:15:59 PM To: MDSplus/mdsplus [email protected] Cc: Subscribed [email protected] Subject: [MDSplus/mdsplus] Python can not call methods of devices written in other languages (C, TDI, JAVA (#2111)
When scripting MDSplus in python, methods of devices not implemented in python can not be called.
There is a work around by calling tree.tcl('do/meth...')
I think we may be able to put something in getattribute in TreeNode to fix this. If after it fails to find a descendant or a tag it could check:
if self.record._class == MDSplus.compound.Conglom :
and if so return something which calls TreeDoMethod.
There are some issues with this:
- the real properties are the last case in the routine.
- for device like things how do we distinguish device methods from real properties since we have not enquiry API to find available methods, and we do not want to actually call the method here, just return something that would call the method.
- this could be more magic syntax ?
- We need a. helper routine to return which calls TreeDoMethod
Any thoughts about this ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMDSplus%2Fmdsplus%2Fissues%2F2111&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626133163&sdata=G%2FSc9t9Z4ZU2UNjPLgZyPS1%2FhxxubRtXG%2B%2BFn%2B%2B6WCU%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABPRFLUIMNEQLSUNCLNVOSLSEDSA7ANCNFSM4QYKXKMQ&data=02%7C01%7C%7C8fe255cb1c174f58eeea08d850d4abe5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637348221626143159&sdata=eDTRP2FefaMaKzuV4vdjjXs5jKACGb46S3FWE9zOTTg%3D&reserved=0.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/MDSplus/mdsplus/issues/2111#issuecomment-687146591, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABY5AZKZVT26FJNPFN7GYZLSEDTXNANCNFSM4QYKXKMQ.
-- Joshua Stillerman Research Engineer MIT Plasma Science and Fusion Center 617.253.8176 [email protected] mailto:[email protected]
We will add a doMethod(name, *args)
to Python as Timo suggested.