1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 | Index | 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 <2021> 2022 2023 2024 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: pvaPy: PvObject - odict_keys not subscriptable issue |
From: | "Veseli, Sinisa via Tech-talk" <tech-talk at aps.anl.gov> |
To: | Kuldeep Joshi <kuldeep.joshi at gmail.com> |
Cc: | "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov> |
Date: | Wed, 6 Oct 2021 22:27:46 +0000 |
Hi,
I have not used pcaspy myself, but there are pip packages for python3.
As far as your second question, I am no phoebus expert, but it seems like the intent of the other widgets on the page was to show how to display arbitrary structures in addition to displaying tables.
In any case, in my environment the server.py example did not quite work as expected for python with numpy installed (see fixes below).
Hope this helps,
Sinisa
bluegill2> git diff ./app/display/model/src/main/resources/examples/table/server.py
diff --git a/app/display/model/src/main/resources/examples/table/server.py b/app/display/model/src/main/resources/examples/ta
index d8e6d17..791040e 100644
--- a/app/display/model/src/main/resources/examples/table/server.py
+++ b/app/display/model/src/main/resources/examples/table/server.py
@@ -12,7 +12,7 @@ print("")
#nt_table: complies with NTTable Normative Type
#note: Unless the PvObject's 'values' field is created with an ordered dict, the ordering will be lost.
ntTablePV = PvObject( {'labels' : [STRING],
- 'value' : OrderedDict([('id_field', [INT]), ('name_field', [STRING]), ('description_field', [STRING])
+ 'value' : dict(OrderedDict([('id_field', [INT]), ('name_field', [STRING]), ('description_field', [STR
'epics:nt/NTTable:1.0')
ntTablePV['labels'] = ['ID', 'Name', 'Description']
#every field under "value" must have the same length (number of elements)
@@ -23,9 +23,10 @@ ntTablePV.setStructure({'id_field': [1, 2, 3, 4],
#table: a table-like pv that contains a "value" which is a structure
#tablePV is not an NTTable because "dingus" is a structure, not a scalar type
#Only the "value" field is displayed; the meta-data field is ignored
-dingus_types = OrderedDict([('Name', [STRING]), ('Quality', [DOUBLE])])
-value_types = OrderedDict([('OK', [BOOLEAN]), ('Dingus', dingus_types)])
+dingus_types = dict(OrderedDict([('Name', [STRING]), ('Quality', [DOUBLE])]))
+value_types = dict(OrderedDict([('OK', [BOOLEAN]), ('Dingus', dingus_types)]))
tablePV = PvObject({'meta_data' : STRING, 'value' : value_types})
+tablePV.useNumPyArrays = False
tablePV['meta_data'] = 'Some example meta-data stuff'
dingus = {'Name' : ["Thing1", "Thing2", "Thing3"], 'Quality' : [90, 50, 75]}
--
Siniša Veseli
Scientific Software Engineering & Data Management
Advanced Photon Source
Argonne National Laboratory
sveseli at anl.gov
(630)252-9182From: Kuldeep Joshi <kuldeep.joshi at gmail.com>
Sent: Wednesday, October 6, 2021 12:53 AM To: Veseli, Sinisa <sveseli at anl.gov> Cc: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov> Subject: Re: pvaPy: PvObject - odict_keys not subscriptable issue Hello,
Thank you the code with your suggested modification is working.
I am unable to execute ca_table_server.py located in the table folder (of Phoebus Examples) with Python3. Can I use the pcaspy lib for python3
It works fine with python2.7
I tried another Phoebus demo code server.py at this path "Display Builder/table" located at
Here I have incorporated the dict() call as per your suggestion. Table is visible only for the first table widget.
For the remaining widgets I am seeing structure for the pva. I guess the structure is not proper.
pl find the snap attached.
Regards,
Kuldeep
On Tue, Oct 5, 2021 at 2:08 PM Veseli, Sinisa <sveseli at anl.gov> wrote:
|