Using from queue import Queue
works for me under Python 3. When you actually use Queue, you'll need to change all references of "Queue.Queue" to a simple "Queue". Alternatively, you can use the compatibility shim "six", but then you have to be sure it's been installed on the user's system. I've included a copy with WeeWX V4, so that's why restx.py uses it. But, in your situation, you can't count on it being there, so it's more robust to simply make the changes we've outlined. -tk On Mon, Mar 25, 2019 at 7:44 AM <[email protected]> wrote: > On Monday, 25 March 2019 09:33:57 UTC-3, Tom Keffer wrote: >> >> 2. For a queue, do this: >> >> try: >> # Python 2 >> from Queue import Queue >> except ImportError: >> # Python 3 >> from queue import Queue >> >> Then use "Queue" throughout your code. >> >> Tom, > > The above code doesn't work in python 3. > I've got error: Import of driver failed: type object 'Queue' has no > attribute 'Queue' (<class 'AttributeError'>) > > But... > > I found the following code in restx.py: > > # Python 2/3 compatiblity shims > import six > from six.moves import queue > ... > _record = self.queue.get() > ... > if self.queue.qsize() <= self.max_backlog: > ... > self.archive_queue = queue.Queue() > ... > self.loop_queue.put( > > Should I use the syntax of restx.py in rtldavis.py? > > Luc >
