kernsuite / packaging

Use this repository to report issues with packages or request new packages
13 stars 4 forks source link

MeqTrees KERN 6 not starting properly on XUbuntu 18.04 #233

Closed twillis449 closed 3 years ago

twillis449 commented 4 years ago

So I just downloaded the KERN-6 version of MeqTrees and at startup I get [twillis-e6540-i7 3:59pm] [fpa_elements]> meqbrowser Welcome to the MeqTrees Browser! Please wait a second while the GUI starts up.

WARNING: couldn't import plugin 'Timba.Plugins.quickref_plotter' (API 'QString' has already been set to version 1) This plugin will not be available.

WARNING: couldn't import plugin 'Timba.Plugins.collections_plotter' (API 'QString' has already been set to version 1) This plugin will not be available.

WARNING: couldn't import plugin 'Timba.Plugins.array_plotter' (API 'QString' has already been set to version 1) This plugin will not be available.

WARNING: couldn't import plugin 'Timba.Plugins.result_plotter' (API 'QString' has already been set to version 1) This plugin will not be available. Binding to local socket =meqbrowser-1000:1 Binding to TCP port 5000, remote meqservers may connect with gwpeer=:5000 Bus::open: Can not get ibus-daemon's address. IBusInputContext::createInputContext: no connection to ibus-daemon /usr/bin/meqserver: error while loading shared libraries: libboost_thread.so.1.58.0: cannot open shared object file: No such file or directory

The libboost libraries on my xubuntu 18.04 are at version 1.65 and not 1.58 The 'API 'QString' has already been set to version 1' complaint probably has something to do with PythonQwt. as there is an issue about that on the github site for PythonQwt. Anyway I see you guys are trying to shoehorn that code I wrote for Python 3 back into Python 2 and we never tested PythonQwt properly for Python2.

I did have MeqTrees working on another computer with xubuntu 18.04 but then just a couple of days ago the software updater went and updated some Qt stuff and after that , meqtrees wouldn't work there either. :(

gijzelaerr commented 4 years ago

hm yeah, thats odd, should be 1.65:

https://packages.ubuntu.com/search?keywords=libboost&searchon=names&suite=bionic&section=all

and we don't hardcode 1.58 in the rules:

https://github.com/kernsuite-debian/meqtrees-timba/blob/master/debian/control

also, it should use python3 by now. Are you sure you are not using an older version? wat version of the meqtrees package ar you using.

twillis449 commented 4 years ago

I'm using the the version of Mequrees you distribute as part of KERN-6. This is oriented toward ubuntu 18.04 and dumps its python code into /usr/lib/python2.7/dist-packages so its clearly still using python2 . With my current xubuntu18.04 the first thing that fails is the simple script Cattery/qt.py which has the code ######################

This file is a guard against import of PyQt3 modules.

Since we have switched to using PyQt4, any scripts that import PyQt3 (moudle 'qt')

produce an unseemly segfault. To avoid the segfault, this qt.py module should

intercept such import statements.

print("I think I Caught a Qt3 import"); print("But I'm probably being confused by the Python-qwt interface")

If I uncomment the next three lines, of course things just stop right here!

raise RuntimeError("""It appears a TDL script is trying to import PyQt3.

PyQt3 is incompatible with the current version of MeqTrees. Please update

your scripts.""");

############################ Anyway a current run gives ...

Script started on 2020-10-08 09:03:34-070 [twillis-Latitude-E6540 9:03am]AGW> meqbrowser.py Welcome to the MeqTrees Browser! Please wait a second while the GUI starts up. Gtk-^[[1;32mMessage^[[0m: ^[[34m09:03:53.416^[[0m: Failed to load module "atk-bridge" I think I Caught a Qt3 import But I'm probably being confused by the Python-qwt interface

WARNING: couldn't import plugin 'Timba.Plugins.array_plotter' (No module named QtGui) This plugin will not be available.

WARNING: couldn't import plugin 'Timba.Plugins.result_plotter' (No module named QtGui) This plugin will not be available. Binding to local socket =meqbrowser-1000:1 Binding to TCP port 5000, remote meqservers may connect with gwpeer=:5000 (Meow.MSUtils: found /usr/bin/lwimager, can use it for imaging.) (Meow.MSUtils: found image viewer /usr/bin/tigger) (Meow.MSUtils: found image viewer /usr/bin/kvis)

twillis449 commented 4 years ago

Sorry - no idea why the previous stuff is suddenly capitalised.

gijzelaerr commented 4 years ago

What version of the package I mean

Op vr 9 okt. 2020 01:49 schreef Tony Willis notifications@github.com:

Sorry - no idea why the previous stuff is suddenly capitalised.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kernsuite/packaging/issues/233#issuecomment-705886604, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACPVJE3BDFW5MQDOCD43STSJZFYPANCNFSM4SGVFCFA .

twillis449 commented 4 years ago

I'm not sure - how do I tell? It would appear that the 'date' associated with the original code is Nov 19, 2019. All I'm doing to get meqtrees is issuing the command 'sudo apt-get install meqtrees' Looking at the original code on GitHub, I see that this is supposed to be the python3 compatible version but it should work with python 2 because the scripts all contain 'from future import ...' statements. Hum - I do have a complete Ubuntu 20.04 OS. Maybe I'll try going through the masochistic exercise of trying to compile MeqTrees from scratch with python3.

gijzelaerr commented 4 years ago

$ dpkg -l | grep meqtrees

gijzelaerr commented 4 years ago

Ok it looks like you are right, the timba package has been ported to python3:

https://github.com/kernsuite-debian/meqtrees-timba/blob/master/debian/control

but cattery has not been:

https://github.com/kernsuite-debian/meqtrees-cattery/blob/master/debian/control

@Athanaseus what do you think? I don't really understand how the cattery package can be build and/or installed, since it depends on python-meqtrees-timba while we only make a python3-meqtrees-timba now?

Athanaseus commented 4 years ago

Kern-6 has python-meqtrees-*. Currently, I was porting everything to python3-* (that's why timba on github says python3, but that's built for KERN-7 i.e. focal).

I tried reproducing the error above but I couldn't, I just get the warnings but it links to the right boost library. I tested this on ubuntu18.04.

PS: dpkg -l | grep meqtrees


ii  meqtrees                                      1.7.0-1kern4                                     amd64        Meta package that depends on all MeqTrees subprojects.
ii  meqtrees-timba                                1.7.0-1kern2                                     all          implementing and solving arbitrary Measurement Equations
ii  python-astro-kittens                          1.4.3-1kern1                                     amd64        Collection of Python utility functions for purr, tigger, meqtrees and others
ii  python-meqtrees-cattery                       1.7.0-1kern4                                     amd64        Frameworks for simulation and calibration of radio interferometers
ii  python-meqtrees-timba                         1.7.0-1kern2                                     all          Implementing and solving arbitrary Measurement Equations```
twillis449 commented 4 years ago

Yes you need both Kittens and Catterey installed to do anything useful with meqtrees-timba. Trying to build Cattery with python3 promptly croaks with

.byte-compiling /usr/local/lib/python3.8/dist-packages/Cattery/Pyxides/stefcal.py to stefcal.cpython-38.pyc
  File "/usr/local/lib/python3.8/dist-packages/Cattery/Pyxides/stefcal.py", line 505
    offs = numpy.array([ getattr(v,attr)+sign*e/4 for v,e in (x,xe),(y,ye)
                                                                   ^
SyntaxError: invalid syntax

The octopussy.py script also croaks:

Traceback (most recent call last):
  File "/usr/local/bin/meqbrowser.py", line 125, in <module>
    from Timba import octopussy
  File "/usr/local/lib/python3.8/dist-packages/Timba/octopussy.py", line 306
    def event_loop (self,await=[],timeout=None):
                         ^
SyntaxError: invalid syntax
twillis449 commented 4 years ago

I do have a working meqtrees package on a separate disk with ubuntu 18.04 and an earlier KERN release, so don't worry about the issues I was raising - I'll just be very careful about OS upgrades on that disk.

[Dell_samsungSSD 11:24am] [twillis]>  dpkg -l | grep meqtrees
ii  libmeqtrees-timba                             1.6.0-1                                          amd64        implementing and solving arbitrary Measurement Equations
ii  meqtrees                                      1.5.3-1kern2                                     amd64        Meta package that depends on all MeqTrees subprojects.
ii  meqtrees-timba                                1.6.0-1                                          amd64        implementing and solving arbitrary Measurement Equations
ii  python-astro-kittens                          1.4.2-1kern1                                     amd64        Collection of Python utility functions for purr, tigger, meqtrees and others
ii  python-meqtrees-cattery                       1.5.3-1kern2                                     amd64        Frameworks for simulation and calibration of radio interferometers
ii  python-meqtrees-timba                         1.6.0-1                                          amd64        implementing and solving arbitrary Measurement Equations
[Dell_samsungSSD 11:24am] [twillis]> 
Athanaseus commented 4 years ago

.byte-compiling /usr/local/lib/python3.8/dist-packages/Cattery/Pyxides/stefcal.py to stefcal.cpython-38.pyc File "/usr/local/lib/python3.8/dist-packages/Cattery/Pyxides/stefcal.py", line 505 offs = numpy.array([ getattr(v,attr)+sign*e/4 for v,e in (x,xe),(y,ye) ^ SyntaxError: invalid syntax

Currently building py3 for focal and I got the same too. I just made a patch and i will push the changes upstream too.

Author: KERN packaging <packaging@kernsuite.info>
Date: 2020-10-12
Subject: Python3 for-loop syntax

diff --git a/Cattery/Calico/OMS/StefCal/Pyxides/stefcal.py b/Cattery/Calico/OMS/StefCal/Pyxides/stefcal.py
index f7fa7d3..f032845 100644
--- a/Cattery/Calico/OMS/StefCal/Pyxides/stefcal.py
+++ b/Cattery/Calico/OMS/StefCal/Pyxides/stefcal.py
@@ -502,8 +502,8 @@ def make_ifrgain_plots (filename="$STEFCAL_DIFFGAIN_SAVE",prefix="IG",feed="$IFR
     #   for l1,l2,(x,xe),(y,ye) in content ]);
     minre, maxre, minim, maxim = 2, -2, 2, -2
     for l1,l2,(x,xe),(y,ye) in content:
-        offs = numpy.array([ getattr(v,attr)+sign*e/4 for v,e in (x,xe),(y,ye) 
-                  for attr in 'real','imag' for sign in 1,-1 ])
+        offs = numpy.array([ getattr(v,attr)+sign*e/4 for v,e in ((x,xe),(y,ye))
+                  for attr in ('real','imag') for sign in (1,-1) ])
         minre, maxre = min(x.real-xe/4, y.real-ye/4, minre), max(x.real+xe/4, y.real+ye/4, maxre)
         minim, maxim = min(x.imag-xe/4, y.imag-ye/4, minim), max(x.imag+xe/4, y.imag+ye/4, maxim)
     # plot labels
@@ -717,7 +717,7 @@ def make_gain_plots (filename="$STEFCAL_GAIN_SAVE",prefix="G",ylim=None,ylim_off
         else:
           xhminmax = (min(xhminmax[0],amin),max(xhminmax[1],amax));

-  for xaxis,yaxis,label in (0,1,"timeslot"),(1,0,"chan"):
+  for xaxis,yaxis,label in ((0,1,"timeslot"),(1,0,"chan")):
     pylab.figure(figsize=(5*ncols,3*nrows))
     for row,ant in enumerate(antennas):
       for icol,j in enumerate([0,1] if diagonal else [0,3,1,2]):
diff --git a/Cattery/Calico/calico-wsrt-old.py b/Cattery/Calico/calico-wsrt-old.py
index 49b4886..6bc488d 100644
--- a/Cattery/Calico/calico-wsrt-old.py
+++ b/Cattery/Calico/calico-wsrt-old.py
@@ -388,15 +388,15 @@ def _define_forest(ns,parent=None,**kw):
     if cal_what == CAL.VIS:
       pass;
     elif cal_what == CAL.AMPL:
-      [ x('ampl',p,q) << Meq.Abs(x(p,q)) for p,q in ifrs for x in rhs,lhs ];
+      [ x('ampl',p,q) << Meq.Abs(x(p,q)) for p,q in ifrs for x in (rhs,lhs) ];
       lhs = lhs('ampl');
       rhs = rhs('ampl');
     elif cal_what == CAL.LOGAMPL:
-      [ x('logampl',p,q) << Meq.Log(Meq.Abs(x(p,q))) for p,q in ifrs for x in rhs,lhs ];
+      [ x('logampl',p,q) << Meq.Log(Meq.Abs(x(p,q))) for p,q in ifrs for x in (rhs,lhs) ];
       lhs = lhs('logampl');
       rhs = rhs('logampl');
     elif cal_what == CAL.PHASE:
-      [ x('phase',p,q) << Meq.Arg(x(p,q)) for p,q in ifrs for x in rhs,lhs ];
+      [ x('phase',p,q) << Meq.Arg(x(p,q)) for p,q in ifrs for x in (rhs,lhs) ];
       [ rhs('ampl',p,q) << Meq.Abs(rhs(p,q)) for p,q in ifrs  ];
       lhs = lhs('phase');
       rhs = rhs('phase');
Athanaseus commented 4 years ago

Traceback (most recent call last): File "/usr/local/bin/meqbrowser.py", line 125, in from Timba import octopussy File "/usr/local/lib/python3.8/dist-packages/Timba/octopussy.py", line 306 def event_loop (self,await=[],timeout=None): ^ SyntaxError: invalid syntax

I got relatively the same:

raceback (most recent call last):                                                                       
  File "/usr/lib/python3.8/py_compile.py", line 144, in compile
    code = loader.source_to_code(source_bytes, dfile or file,    
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/Timba/Apps/app_proxy.py", line 332
    res = self._pwp.await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
                    ^                                                                                                                                                                                              
SyntaxError: invalid syntax                                                                              

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/py_compile.py", line 197, in main
    compile(filename, doraise=True)
  File "/usr/lib/python3.8/py_compile.py", line 150, in compile
    raise py_exc                                    
__main__.PyCompileError:   File "/usr/lib/python3/dist-packages/Timba/Apps/app_proxy.py", line 332
    res = self._pwp.await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
                    ^                               
SyntaxError: invalid syntax

This seems like a python3 violation. "in Python 3.6 you could use await as a variable name or function name, but as of Python 3.7, that word has been added to the keyword list. Now, if you try to use await as a variable or function name, this will cause a SyntaxError if your code is for Python 3.7 or later." https://realpython.com/invalid-syntax-python/#common-syntax-problems

twillis449 commented 4 years ago

That's very interesting. So why can't python give an error something like 'illegal use of keyword' or something similar, instead of 'invalid syntax'. I just couldn't spot any invalid syntax anywhere in that line of code or at the end of the previous function.

Athanaseus commented 4 years ago

Yes, I agree not a very informative exception.

"It might be a little harder to solve this type of invalid syntax in Python code because the code looks fine from the outside. If your code looks good, but you’re still getting a SyntaxError, then you might consider checking the variable name or function name you want to use against the keyword list for the version of Python that you’re using."

In [1]: import keyword 
   ...: print(keyword.kwlist)                       
['False', 'None', 'True', 'and', 'as', 'assert', 'async', 'await', 'break',
 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally',
 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal',
 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
twillis449 commented 4 years ago

Looking at the octopussy. py code, I think some of this code like the 'await' and 'whenever' functions are Oleg's attempts to replicate ancient glish code from the early 2000s. I wonder if any of this stuff is used elsewhere in the current system.

twillis449 commented 4 years ago

Grumble - looks like the author of the PythonQwt package has changed the python 'import' structure for the version which is actually supplied as part of Ubuntu 20.04 package manager. So all the visualization plugins require some modifications. Not that much work but it will take a few days.

twillis449 commented 4 years ago

Did you come to any conclusion about how to handle the now forbidden 'await' function in python 3? Or what to replace it with? It turns out that there are quite a few mods needed in various places to get MeqTrees to actually work properly with python 3. And I'm stuck with the 'await'stuff. :(

Athanaseus commented 4 years ago

Did you come to any conclusion about how to handle the now forbidden 'await' function in python 3? Or what to replace it with?

I replaced any await function and keyword to _await. See patch below, I will confirm with @o-smirnov before I push changes to upstream.

Author: KERN packaging <packaging@kernsuite.info>
Date: 2020-10-17
Subject: Avoid using the python3 await keyword

diff --git a/OCTOPython/src/octopussy.py b/OCTOPython/src/octopussy.py
index a099e65..7f65550 100644
--- a/OCTOPython/src/octopussy.py
+++ b/OCTOPython/src/octopussy.py
@@ -193,11 +193,11 @@ class proxy_wp(octopython.proxy_wp,verbosity):

   # this is meant to pause and resume event processing -- no implementation
   # needed since this class is synchronous (i.e., events are not being dealt 
-  # with outside await/event_loop calls), but thje threaded proxy class
+  # with outside _await/event_loop calls), but thje threaded proxy class
   # may override this
   def pause_events (self):
     """pauses the event loop for this wp (if any); this will halt the
-    processing of any whenevers. Note that a call to await() or event_loop()
+    processing of any whenevers. Note that a call to _await() or event_loop()
     or flush_events() will resume the event loop automatically.
     """;
     pass;
@@ -299,11 +299,11 @@ class proxy_wp(octopython.proxy_wp,verbosity):
   # event_loop()
   # Calls receive() in a continuous loop, processes events by invoking
   # their whenever handlers.
-  # If await is supplied (is a hiid), returns when a message matching the
+  # If _await is supplied (is a hiid), returns when a message matching the
   # await mask is received (returns message).
   # If timeout (in seconds) is supplied, returns None after it has expired.
   # Otherwise loop indefinitely, or until the C++ ProxyWP has exited
-  def event_loop (self,await=[],timeout=None):
+  def event_loop (self,_await=[],timeout=None):
     """runs event loop for this WP -- calls receive() to fetch messages,
     dispatches whenevers, discards messages not matching a whenever. 'await'
     may be set to one or more msgids, in this case the method will  exit when a
@@ -311,9 +311,9 @@ class proxy_wp(octopython.proxy_wp,verbosity):
     limit, use None to loop indefinitely (or until the C++ WP has  exited). If
     timeout=0, processes all pending messages and returns. 
     """;
-    # convert await argument to list of hiids
-    await = make_hiid_list(await);
-    _dprint(1,"running event loop, timeout",timeout,"await",await);
+    # convert _await argument to list of hiids
+    _await = make_hiid_list(_await);
+    _dprint(1,"running event loop, timeout",timeout,"await",_await);
     if timeout is None: 
       endtime = 1e+40; # quite long enough...
     else:
@@ -334,20 +334,20 @@ class proxy_wp(octopython.proxy_wp,verbosity):
         continue;
       # got message, process it
       self._dispatch_whenevers(msg);
-      # check for a match in the await-list
-      for aw in await:
+      # check for a match in the _await-list
+      for aw in _await:
         if aw.matches(msg.msgid):
           _dprintf(3,"matches await %s, returning\n",aw);
           return msg;
     # end of while-loop, if we dropped out, it's a timeout, return None
     return None

-  def await (self,what,timeout=None,resume=False):
-    """alias for event_loop() with an await argument.
-    if resume is true, resumes the event loop before commencing await. This
+  def _await (self,what,timeout=None,resume=False):
+    """alias for event_loop() with an _await argument.
+    if resume is true, resumes the event loop before commencing _await. This
     is meant for child classes only.
     """;
-    return self.event_loop(await=what,timeout=timeout);
+    return self.event_loop(_await=what,timeout=timeout);

   # flush_events(): dispatches all queued events
   #   this is actually an alias for event_loop with a 0 timeout
@@ -412,11 +412,11 @@ class proxy_wp_thread(proxy_wp):

   # this is meant to pause and resume event processing -- no implementation
   # needed since threads don't actually work for now (i.e., events are
-  # not being deal with outside await/event_loop calls)
+  # not being deal with outside _await/event_loop calls)

   def pause_events (self):
     """pauses the event loop for this wp (if any); this will halt the"
-    processing of any whenevers. Note that a call to await() or event_loop()"
+    processing of any whenevers. Note that a call to _await() or event_loop()"
     or flush_events() will resume the event loop automatically.
     """;
     self._lock.acquire();
@@ -432,12 +432,12 @@ class proxy_wp_thread(proxy_wp):
       self._paused = max(self._paused-1,0);
     _dprintf(3,"resuming event loop (count %d)\n",self._paused);

-  # await blocks until the specified message has been received
+  # _await blocks until the specified message has been received
   # (with optional timeout)
-  def await (self,what,timeout=None,resume=False):
+  def _await (self,what,timeout=None,resume=False):
     cur_thread = self._api.currentThread();
     if cur_thread is self._thread:
-      raise AssertionError("can't call await() from event handler thread");
+      raise AssertionError("can't call _await() from event handler thread");
     thread_name = cur_thread.getName();
     _dprint(2,"await: thread",thread_name);
     _dprint(2,"await: waiting for",what,"timeout ",timeout);
@@ -594,7 +594,7 @@ if __name__ == "__main__":
 #  time.sleep(.5);

   print("awaiting on wp4...");
-  res = wp4.await("reflect.*",resume=True);
+  res = wp4._await("reflect.*",resume=True);
   print(("await result: ",res));

   print("=== (3) ===");
@@ -623,7 +623,7 @@ if __name__ == "__main__":
   print(('wp2 queue: ',wp2.num_pending()));
   print(('wp3 queue: ',wp3.num_pending()));
   print('going into wp3.event_loop()');
-  wp3.event_loop(await='x.*');
+  wp3.event_loop(_await='x.*');

   wp3.cancel_whenever(we3);
   wp4.cancel_whenever(we4);
diff --git a/PyApps/src/Apps/app_proxy.py b/PyApps/src/Apps/app_proxy.py
index 3f69887..195b3e5 100644
--- a/PyApps/src/Apps/app_proxy.py
+++ b/PyApps/src/Apps/app_proxy.py
@@ -329,7 +329,7 @@ class app_proxy (verbosity):
         timeout = 5;
       while self.state is None:
         self.dprint(2,'no connection to app, awaiting (wait=',wait,')');
-        res = self._pwp.await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
+        res = self._pwp._await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
         self.dprint(3,'await returns',res);
         if time.time() >= endtime:
           raise RuntimeError("timeout waiting for connection");
@@ -404,7 +404,7 @@ class app_proxy (verbosity):
       args = (self._rcv_prefix + args[0],) + args[1:];
     return self._pwp.whenever(*args,**kwargs);

-  def await (self,what,timeout=None,resume=False):
+  def _await (self,what,timeout=None,resume=False):
     "interface to pwp's event loop, in the await form";
     if timeout is not None:
       await_timeout = min(1,timeout);
@@ -415,7 +415,7 @@ class app_proxy (verbosity):
       # throw error on disconnect
       if self.app_addr is None:
         raise RuntimeError("lost connection while waiting for event "+str(what));
-      res = self._pwp.await(self._rcv_prefix + what,timeout=await_timeout,resume=resume);
+      res = self._pwp._await(self._rcv_prefix + what,timeout=await_timeout,resume=resume);
       # return message if something is received
       if res is not None:
         return res;
diff --git a/PyApps/src/Apps/meqserver.py b/PyApps/src/Apps/meqserver.py
index fa21ee0..d101be3 100644
--- a/PyApps/src/Apps/meqserver.py
+++ b/PyApps/src/Apps/meqserver.py
@@ -124,7 +124,7 @@ class meqserver (multiapp_proxy):
       self.dprint(5,'arguments are ',args);
       self.pause_events();
       self.send_command('command'+command,payload);
-      msg = self.await(replyname,resume=True,timeout=wait);
+      msg = self._await(replyname,resume=True,timeout=wait);
       return msg.payload;
     # else simply send command
     else: 
diff --git a/PyApps/src/Apps/multiapp_proxy.py b/PyApps/src/Apps/multiapp_proxy.py
index a534d03..9c6417b 100644
--- a/PyApps/src/Apps/multiapp_proxy.py
+++ b/PyApps/src/Apps/multiapp_proxy.py
@@ -433,7 +433,7 @@ class multiapp_proxy (verbosity):
         timeout = 5;
       while not self.current_server:
         self.dprint(2,'no connection to servers, awaiting (wait=',wait,')');
-        res = self._pwp.await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
+        res = self._pwp._await('*',resume=True,timeout=5);  # await anything, but keep looping until status changes
         self.dprint(3,'await returns',res);
         if time.time() >= endtime:
           raise RuntimeError("timeout waiting for connection");
@@ -512,7 +512,7 @@ class multiapp_proxy (verbosity):
       args = (self._rcv_prefix + args[0],) + args[1:];
     return self._pwp.whenever(*args,**kwargs);

-  def await (self,what,timeout=None,resume=False):
+  def _await (self,what,timeout=None,resume=False):
     "interface to pwp's event loop, in the await form";
     if timeout is not None:
       await_timeout = min(1,timeout);
@@ -523,7 +523,7 @@ class multiapp_proxy (verbosity):
       # throw error on disconnect
       if not self.servers:
         raise RuntimeError("lost all connections while waiting for event "+str(what));
-      res = self._pwp.await(self._rcv_prefix + what,timeout=await_timeout,resume=resume);
+      res = self._pwp._await(self._rcv_prefix + what,timeout=await_timeout,resume=resume);
       # return message if something is received
       if res is not None:
         return res;
o-smirnov commented 4 years ago

So as I understand it, it's just because Python 3 has gone and reserved a keyword, we can't use it as a functional name anymore? So you've just renamed the function?

That's perfectly fine by me, please make a PR and push it.

gijzelaerr commented 4 years ago

looks like it. @Athanaseus if you have a conflict between a variable and a keyword you usually append, not prepend un underscore. So type_, file_, await_. Using the _ prefix marks a variable private, which you probably don't want in this case and can have unexpected results.

o-smirnov commented 4 years ago

Good point @gijzelaerr, I'd forgotten about that. But BTW, the "_privateness" is just a convention and not enforced in Python, right? It just makes editors highlight it...

gijzelaerr commented 4 years ago

https://stackoverflow.com/questions/1301346/what-is-the-meaning-of-single-and-double-underscore-before-an-object-name

_single_leading_underscore: weak "internal use" indicator. E.g. from M import * does not import objects whose name starts with an underscore.

o-smirnov commented 4 years ago

"it still is possible for a determined soul to access or modify a variable that is considered private", or as they say in the Mother country, it's the bare-arsed that are the most cunning...

twillis449 commented 4 years ago

I've mentioned this before (but yes I forget about them myself) there are two scripts available to help with porting code - firstly 2to3 - see https://stackoverflow.com/questions/20458011/how-to-use-2to3-properly-for-python and b) pyqt4yopyqt5 - see https://github.com/rferrazz/pyqt4topyqt5

The Signals structure is changed in PyQt5 and is not backward compatible with PyQt4. Since PyQt4 is obsolete and not supported in Ubuntu 20.04 you have to make the great lurch forward, like it or not.

gijzelaerr commented 3 years ago

since this issue is mostly about getting meqtrees to work on a modern (py3) distro, i'm moving this discussion to the meqtrees issue tracker: https://github.com/ska-sa/meqtrees-cattery/issues/109