Re: [Dorset] Raspberry Pi Issue with hwclock
On Sunday, 10 September 2017 16:24:51 BST Ralph Corderoy wrote: > > this makes us wait for up to 10 minutes before the system syncs, but > > when it does the two clocks are exactly the same. > > That's pretty lousy. It would be nice for the NTP server to know to > trust the RTC and be happy to start serving it from the off. Yes. But we can live with this if we have to. > > The bad news is that I have got very unreliable timekeeping from the > > realtime clock on the master Pi. Sometimes it appears to be keeping > > time, sometimes it gains or loses several minutes in an hour. > > Start with a freshly downloaded Raspbian image, do the minimum required > from the instructions to use the RTC, do not add NTP, etc. Just see if > the RTC, the kernel, and userspace play well together over the hours and > days. Then you'll know it's your tinkering that's the problem. It > still smells like multiple parties are trying to adjust for creep. I'm kind of doing the other thing at the moment; eg disabling NTP and then using the hwclock-set script from the Bells system if that doesn't work. There's a fair amount of work gone into configuring the system at the moment and I'd rather not have to rebuild it if I don't have to. Having said that, I did upgrade both Pis from Jessie to Stretch, so I may end up having to start from scratch. > Did I ask this before? Why do the Pis need to be in sync, and to what > accuracy? Do they need to know the actual time on the audience's > wrists, or just be in agreement with each other that it's 15 minutes > since they last gave us a twirl? Both Pis are taking readings and logging them to a file. It is really confusing if the Sump Pi says that there was 700 mm of water in the sump at 10:45 on the 11th and at the same time the Butts Pi is recording 100 mm of water in the butts at 17:50 on the 10th. If NTP proves to be the problem and I'm not able to suss out why, then we'll write a script to run at boot-up on the Butts Pi to read the system clock on the Sump Pi and then set its own clock accordingly. It's not hard to do, I suspect, but NTP seemed to be designed to do that, so that's what we did. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-10-03 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Raspberry Pi Issue with hwclock
Guys, I'm still having problems with our installation at the WMT. I got NTP to work on the remote Pi by using Ralph's ntp-wait work-round; this makes us wait for up to 10 minutes before the system syncs, but when it does the two clocks are exactly the same. That's the good news. The bad news is that I have got very unreliable timekeeping from the realtime clock on the master Pi. Sometimes it appears to be keeping time, sometimes it gains or loses several minutes in an hour. One problem is that everything I try necessitates a delay of at least an hour or so before anything useful can be seen (and of course if it is keeping time then I have to wait even longer) ;-( The setup I have is that the master Pi has a RASClock purchased from ModMyPi, but sourced from Afterthought Software. The setup instructions are here: https://afterthoughtsoftware.com/products/rasclock. I originally posted on the ModMyPi Forum about this, but the response was fairly poor. One issue I had was that we have updated the installation on the two Pis to Raspbian Stretch; the last time I used one of these it was for the Bells software on Jessie. Now to the question. I was comparing the hwclock-set file on my Bells SD Card with the same file on the Sump Pi SD Card and I noticed a difference. The Bells config is missing two changes from the Afterthought website: * Comment out or remove the two lines which contain --systz buts that 's version that works! I've been reading the man page for hwclock to see what --hctosys and --systz do and have been struggling to see how relevant this might be and I note the reference to NTP. Bearing in mind that the NTP server is running on the master Pi (the same one that has the clock), I'm not sure if it's an issue or not. Does anyone have any thoughts on this? I'll quite happily fiddle with the settings, to try to fix this, but I'd like to know what I'm doing and the inherent delay means that it could be days before I know if I've fixed it. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-10-03 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Bournemouth Pub Meeting Tonight, Tuesday 2017-09-05.
On Tuesday, 5 September 2017 09:50:59 BST Ralph Corderoy wrote: > How do you make that char? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Hi everyone!
On Monday, 4 September 2017 17:34:09 BST Hamish MB wrote: > My name is Hamish and I've been an avid user of Linux for around 6-7 > years, and in that time I've enjoyed learning how to program for it in > Python and C++, as well as building Linux from scratch. > > I'm working with Terry Coles on the Wimborne Model Town River > Sustainability project at the moment, if anyone's interested :) > > I tried to add a little bio on the members page, but I can't figure out > how to login. Do I need to register for the wiki somehow as well? Hi Hamish, You certainly need to login to add content, but I've had a login so long now that I can't remember how I created it. I have to admit; I looked around and could only see the Login page, not the registration page. Ralph? Can you remind us? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - Less than a Week to Go
Hi, I'm a bit late posting the reminder this month. The next meeting is just 6 days away at the Broadway, Bournemouth at 20:00 on Tuesday evening, 2017-09-05. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? My turn to drive. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Thursday, 24 August 2017 13:48:59 BST Terry Coles wrote: > On Thursday, 24 August 2017 12:51:38 BST Ralph Corderoy wrote: > > ntp-wait(1) might be of interest: "This can be useful at boot time, to > > delay the boot sequence until after ntpd -g has set the time". > > That is definitely of interest. If all else fails, then this could ensure > that the clocks are synced before we try to run our software. > > However, the man page isn't very helpful with respect to when to launch it > and where from. Since there isn't much point in delaying the start of the > system until NTP itself has started, then I'm assuming that I could put it > into rc.local, except that this file has the following comment in it: > > # This script is executed at the end of each multiuser runlevel. > > If it waits until the end of the runlevel, is that too late? Presumably, as > long as further processing is delayed before we launch our software from > .bashrc, we should be OK. Ralph, Well I tried it in rc.local and it works. It is an interesting experience, because although it does hold up further booting until sync occurs, messages continue to arrive from the boot process for a short time. I assume that this is upstart in action, eg the residual messages come from boot activities triggered by upstart before the command is executed, but which hadn't finished. Anyway, the system then sits there doing next to nothing until the clock syncs (you get a rather abrupt OK) and then our software starts immediately after. I'd still like to know if there is a solution to the 10 minutes of KoDs, but this will work and it isn't as if we are trying to control something that needs microsecond response times. Thanks for your help. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Thursday, 24 August 2017 12:51:38 BST Ralph Corderoy wrote: > Where was this script? I forgotten upstart, but it probably still copes > with scripts in /etc/init.d. If it's one of those, see update-rc.d(8). > https://debian-handbook.info/browse/stable/unix-services.html#sect.system-bo > ot The script that I modified was the standard one to start ntpd. It is installed in /etc/init.d. Anyway, I've moved on a bit since then (see below). > I notice date(1) says UTC on one machine, and GMT on the other. The I hadn't spotted that. I'll make them the same. > `-q' could do with a `-g' if you expect the discrepancy to be large. > The `KoD... inconsistent xmt/org/rec timestamps. Ignoring.' that last > some minutes are because the incoming packets from the server don't have > those three timestamps set to the xmt one that was sent out. I don't > know why that would be. Yes. I kind of worked out what the error was, but not necessarily the cause. > > As you can see, the sync is quicker, but it still took nearly 5 > > minutes. I'm not sure why the daemon takes that long, but it may be > > as good as it gets. Does anyone know? > > Not getting those `ignoring' messages will probably shorten that. Wouldn't that be nice :-) > > Final question; I can only start ntpd as root, so I intend to put the > > startup line in the /etc/ rc.local. > > If it's installed as a package then it will have a start-up script to > enable, as pointed to above. Look at the contents of the package with > `dpkg -l $packagename'. I think that your ntp-wait (see below) is a better approach anyway. > > I now understand a little more about the Kiss of Death packet that is > > being sent by the server. I have discovered that the server is > > comparing timestamps from the RTC and the system files and suppressing > > the transmission of a valid signal until they are consistent, but why > > they shouldn't be I'm not sure. > > Was https://afterthoughtsoftware.com/products/rasclock closely followed > on installation? Look at dmesg(1) output after booting and see if it > mentions clocks or time sources. Could the `fake-hwclock' they ship in > Raspbian be interfering? I revisited the config instructions at that link and discovered that I'd missed out a step ;-( That's the penalty of having the instructions on one screen and the file being edited on another in a room at other end of the house! I've fixed that now, but I need to leave time for the RTC to get it wrong again, in case there is still some error somewhere. > > Bad news this morning I'm afraid. I turned on the system to confirm > > yesterday's results and ran 'sudo ntpd -q' immediately after buttspi > > had booted, exactly as I did yesterday. The daemon reported its > > progress, exactly as before, but it exited without syncing. I tried a > > few more times with the same results. > > That could be the lack of -g mentioned above. I tried this several more times and then went back to the default method of launching ntpd. After approx 10 minutes the clocks synced. I'll investigate the discrepancy between the timezones on the two devices and see if that helps. > ntp-wait(1) might be of interest: "This can be useful at boot time, to > delay the boot sequence until after ntpd -g has set the time". That is definitely of interest. If all else fails, then this could ensure that the clocks are synced before we try to run our software. However, the man page isn't very helpful with respect to when to launch it and where from. Since there isn't much point in delaying the start of the system until NTP itself has started, then I'm assuming that I could put it into rc.local, except that this file has the following comment in it: # This script is executed at the end of each multiuser runlevel. If it waits until the end of the runlevel, is that too late? Presumably, as long as further processing is delayed before we launch our software from .bashrc, we should be OK. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 19:42:02 BST Terry Coles wrote: > On Wednesday, 23 August 2017 18:10:45 BST Terry Coles wrote: > > I then executed 'sudo ntpd -q' after logging into buttspi. I've put the > > screenshot of the results at: > > > > http://hadrian-way.co.uk/Misc/Butts_Pi_Screenshot.png > > > > As you can see, the sync is quicker, but it still took nearly 5 minutes. > > I'm not sure why the daemon takes that long, but it may be as good as it > > gets. Does anyone know? Is it because it takes that long for the RTC and > > the System Clock on the server to home in on each other? Bad news this morning I'm afraid. I turned on the system to confirm yesterday's results and ran 'sudo ntpd -q' immediately after buttspi had booted, exactly as I did yesterday. The daemon reported its progress, exactly as before, but it exited without syncing. I tried a few more times with the same results. I then checked the time on sumppi and the RTC had lost nearly an hour overnight. I can't understand this; the battery seems fine, it kept good time on Tuesday night, although it kept bad time last night and on Monday night. I'm going to put the RTC onto one of my Pis this afternoon and see if it keeps good time on that. Does anyone have any ideas why the RTC should be so erratic? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 18:10:45 BST Terry Coles wrote: > I then executed 'sudo ntpd -q' after logging into buttspi. I've put the > screenshot of the results at: > > http://hadrian-way.co.uk/Misc/Butts_Pi_Screenshot.png > > As you can see, the sync is quicker, but it still took nearly 5 minutes. > I'm not sure why the daemon takes that long, but it may be as good as it > gets. Does anyone know? Is it because it takes that long for the RTC and > the System Clock on the server to home in on each other? I now understand a little more about the Kiss of Death packet that is being sent by the server. I have discovered that the server is comparing timestamps from the RTC and the system files and suppressing the transmission of a valid signal until they are consistent, but why they shouldn't be I'm not sure. It may be that is as good as it gets when the server has only just started. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 18:10:45 BST Terry Coles wrote: > I then executed 'sudo ntpd -q' after logging into sumppi. I've put the ^^ buttspi -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 15:44:18 BST Terry Coles wrote: > I've done a bit more research and discovered that it's not systemd that > allows services to start in parallel, but upstart. Raspbian Stretch does > use upstart, so I'm thinking that putting a delay in the ntp startup script > shouldn't have a major effect on the system running. Answering myself again. I tried putting a delay into the ntp service startup script, but it still took approximately 10 minutes to sync, so it's not worth doing it that way. I then did as Ralph originally suggested and stopped the NTP service from running. (I wasn't sure how to do this, so I added and exit 0 to the beginning of the script, which seemed to work OK. If there's a better way, I'd be interested to hear it.) I then executed 'sudo ntpd -q' after logging into sumppi. I've put the screenshot of the results at: http://hadrian-way.co.uk/Misc/Butts_Pi_Screenshot.png As you can see, the sync is quicker, but it still took nearly 5 minutes. I'm not sure why the daemon takes that long, but it may be as good as it gets. Does anyone know? Is it because it takes that long for the RTC and the System Clock on the server to home in on each other? Final question; I can only start ntpd as root, so I intend to put the startup line in the /etc/ rc.local . However, I still need to delay it's execution long enough to allow sumppi and the switch to get going. Is there a better way? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 14:30:12 BST Terry Coles wrote: > Raspberry Pi Stretch is running systemd but the ntpd service file is > installed in /etc/init.d. From this, I'm assuming that if I made a copy of > the ntp.service file and put a delay into it, that would work, but will > this delay the whole boot cycle? I'm vaguely aware that the latest linux > boot techniques allow services to start in parallel, but I'm not sure if > this applies to services that would have been started by init in days of > yore. I've done a bit more research and discovered that it's not systemd that allows services to start in parallel, but upstart. Raspbian Stretch does use upstart, so I'm thinking that putting a delay in the ntp startup script shouldn't have a major effect on the system running. Anyone have any thoughts on this? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Wednesday, 23 August 2017 10:35:16 BST Ralph Corderoy wrote: > > If that proves to be the case, we'll have to delay for a while before > > we do anything or put an RTC on the client Pi and only use NTP to sync > > the two clocks. > > One used to use ntpdate(1) for a one-shot, set this machine's clock from > an NTP source now, command. Its man page suggests `ntpd -q' it the > modern method, having ntpd quit once its work is done. You might want > to have the client do that soon after boot. Ralph, OK. I've established that my RTC is working and keeping good time and I now am certain that the NTP client is syncing to the server after around 10 minutes or so. I think our problem is almost certainly because all the hardware in the system is starting at the same time; that is the Network Switch, the Sump Pi and the Butts Pi all get their power together. We've already delayed the taking of measurements to give the network a chance to get up and running, but I suspect that delaying the start of the NTP Daemon on the sumppi for a minute or so might well improve the sync time. So my last question is, what is the best way to do this? Raspberry Pi Stretch is running systemd but the ntpd service file is installed in /etc/init.d. From this, I'm assuming that if I made a copy of the ntp.service file and put a delay into it, that would work, but will this delay the whole boot cycle? I'm vaguely aware that the latest linux boot techniques allow services to start in parallel, but I'm not sure if this applies to services that would have been started by init in days of yore. What do you think? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Tuesday, 22 August 2017 17:36:34 BST Ralph Corderoy wrote: > > http://hadrian-way.co.uk/Misc/Pi_NTP_Screenshot.png > > Were there any status characters in front of the `remote' IP address in > the top left, do you recall? I don't think so, but I've seen an asterisk in front of 127.127.1.0 (I think) since I added it to the servers list. Apart from this problem, I currently also have a Real Time Clock issue (It seems to drift), so I've done some work on that and shut it down for the night to see what happens to the time after a decent delay. > Can anyone else think what i may be doing wrong? One thing I've noticed > in the output of ntpq -pn is that the 'refid' column contains terms such > as '.XFAC', '.LOC' or '.INIT' > > `refid', if not an IP address, is a KISS code. Not Simple, Stupid, but > Kiss-o'-Death. > https://www.iana.org/assignments/ntp-parameters/ntp-parameters.xhtml#ntp-par Thanks for that, although I don't see either XFAC or LOC in that list. > ameters-2 Your XFAC may be because an interface has changed address > http://lists.ntp.org/pipermail/questions/2010-May/026725.html Thanks for that link.. > I'd stop the NTP stuff running at boot. Boot both Pis. Ensure their > wired interfaces are up with the expected addresses, and work, e.g. you > can ssh from sump to butts, and then back to sump. Then start the ntpd > on sump without having it go into the background. Its status messages > will then appear as you watch. Once it seems happy, then get to butts > and start that side. > https://www.eecis.udel.edu/~mills/ntp/html/debug.html has some other > things to try. That last link has a lot of useful information (and even more in the links within that page). Studying that will give me something to do while I wait for the RTC to reveal its accuracy. I noticed an interesting statement on that page: 'Unless using the iburst option, the client normally takes a few minutes to synchronize to a server. ' Just before I shut down the system for the final time today, I ran date on the client and the time appeared to be correct. Maybe that's all the problem has been; we have to wait for the client to sync. I had been running hwclock -c on sumppi for around 20 minutes at the time. We've generally been booting the two Pi's together (they are both powered from a 19 V PSU connected directly to a DC-DC converter on sumppi and via PoE to another DC- DC converter on buttspi). We then ran date on both machines pretty much straight away, so we maybe never waited long enough. If that proves to be the case, we'll have to delay for a while before we do anything or put an RTC on the client Pi and only use NTP to sync the two clocks. > If you've only a keyboard and monitor on sump to a single TTY, no X, > then screen(1) can be useful to kick off other pseudo TTYs so you can > run the NTP server on one, ssh to butts on another, ... That's pretty much what we've been doing. Thanks for your help. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Monday, 21 August 2017 16:32:12 BST Terry Coles wrote: > For the Client we've added: > > server 192.168.0.2 > > to the server pool. > > For the Server we've added: > > restrict 192.168.0.0 mask 255.255.255.0 > > and: > >broadcast 192.168.0.255 > > However, it doesn't work. > I've examined the output of ntpq -pn, but it doesn't reveal anything to me > that seems untoward, except that the both the Master and Remote Pis list > 192.168.0.2 as the remote. See: > > http://hadrian-way.co.uk/Misc/Pi_NTP_Screenshot.png It still doesn't work. I've trawled the net for ideas and tried quite a few, but nothing seems to make any difference. Can anyone else think what i may be doing wrong? One thing I've noticed in the output of ntpq -pn is that the 'refid' column contains terms such as '.XFAC', '.LOC' or '.INIT', depending on which of the different fixes I've tried, whereas all the examples that I've found on the net seem to refer to another IP Address. I'm assuming that these examples show the results when a device is fully connected to an NTP server on the web, whereas, I'm trying to make my Pi an NTP server, so there's nothing else to refer to. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Monday, 21 August 2017 17:30:18 BST Terry Coles wrote: > > Add the following two lines to your servers config. > > > > server 127.127.1.0 > > fudge 127.127.1.0 stratum 12 > > Hmmm. I tried that and still nogo. Should that have been 127.0.0.1? (I > tried that and it still didn't work.) Just discovered that 127.127.1.0 is correct. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Setting up an NTP Server in a Closed Network
On Monday, 21 August 2017 16:56:50 BST Bob Dunlop wrote: > Everything is sitting at stratum 16 "no trusted clocks", the server won't > offer a syncronisation service at this level. > > The server needs a clock it trusts before it will serve the time. > > Add the following two lines to your servers config. > > server 127.127.1.0 > fudge 127.127.1.0 stratum 12 Hmmm. I tried that and still nogo. Should that have been 127.0.0.1? (I tried that and it still didn't work.) Should those entries be on the Server or the Client (I tried both but) > This tells the server to use the system clock as a reference at stratum > 12. System clock on a Pi is a poor choice since the Pi doesn't have an > RTC so will get clobbered on every power cycle but it should get you > going. I forgot to mention; I have included a RASClock RTC on the Master Pi. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Setting up an NTP Server in a Closed Network
Hi, We've been trying to set up a local NTP Server on our WMT network which consists of a Wireless AP (we're not connecting to the Internet), the 'Master' Pi and a 'Remote' Pi. The Wireless AP is only there for debugging and to act as a Switch and the Pi's are interconnected with Cat 5 cable. Here is what we have done: 1. Allocated static IP addresses to both Pis and restricted the DHCP range on the Wireless AP to avoid conflicts. The Master Pi is 192.168.0.2 and the Remote Pi is 192.168.0.3. 2. Followed the instructions at http://raspberrypi.tomasgreno.cz/ntp-client-and-server.html setting the Remote Pi as the Client and the Master Pi as the Server. For the Client we've added: server 192.168.0.2 to the server pool. For the Server we've added: restrict 192.168.0.0 mask 255.255.255.0 and: broadcast 192.168.0.255 However, it doesn't work. I've examined the output of ntpq -pn, but it doesn't reveal anything to me that seems untoward, except that the both the Master and Remote Pis list 192.168.0.2 as the remote. See: http://hadrian-way.co.uk/Misc/Pi_NTP_Screenshot.png Any ideas? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Book on Python's Flask.
On Monday, 7 August 2017 10:45:46 BST Ralph Corderoy wrote: > https://www.packtpub.com/packt/offers/free-learning for the next twelve > hours or so is offering > https://www.packtpub.com/web-development/learning-flask-framework that I > thought might be of interest to you. They offer a different book each > day. Ralph, Thanks for that; I've now downloaded it, although I'm not sure when I'll get back to Flask since the work on the WMT River System Control and Monitoring Project is now in full swing. I'm very much in hardware mode at the moment. Something for the long Winter nights perhaps :-) Registering on that site proved to be a challenge in itself because the login / register link didn't show up until I had accepted about 40,000 scripts in ScriptSafe. You get used to doing that, but it's pointless having the tool installed if you don't at least assess each script as you allow it. > This email's also in part a test because lug.org.uk disappeared from DNS > for a while due to Nominet issues with validating the registrant, so if > anyone had bounces, that's why and it should be OK now. It arrived :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-09-05 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 17.04 Login Manager Fails to Start X.
On Sunday, 30 July 2017 17:31:56 BST Ralph Corderoy wrote: > Ah, OK, so the fault isn't from booting, but on entering username and > password at the GUI login prompt you fail to get your KDE X desktop. > Are you using SDDM, do you know? The Simple Desktop Display Manager. > It seems to be what KDE have moved to. There will be log files for > whatever the display manager is, and also probably X-server log files > for the X display that the display manager is using. Yes. It's SDDM. The file /var/log/sddm.log is empty. I've checked the other log files for references to SDDM, but nothing stands out. The trouble is that I suspect that when the fault occurs SDDM doesn't even get called, because the process doesn't get that far. > When it works, if you log out rather than shutdown does it get back to > the login manager OK? And you can log back in, ad infinitum? It seems to. (I don't know about ad infinitum; I only have one life :-) ) > You're looking for what packages were upgraded in the run up to the > problem first occurring rather than errors about the upgrade per se. > Try > > fold -80 /var/log/apt/history | less +G > > That will put you at the end, most recent, so you can scroll up. Again. I can't see anything that stands out. I can't quite recall when it started, but there were lots of packages upgraded on the 21st and another large lot on the 15th. The trouble is that I only use this laptop when I'm out or when using my Arduino scope in the workroom, so there could have been a week between me running the updater and then noticing the problem. > > I tried Alt Ctrl F1 to get a virtual console, but nothing happened. > > Try F2 and F7 next time as well as F1; perhaps you're already on F1 and > that's the blank screen and flashing cursor. I failed to mention that I tried all those too, plus the other F keys. ;-( -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 17.04 Booting into the Shell Instead of the Desktop
On Sunday, 30 July 2017 16:10:50 BST Terry Coles wrote: > There is a History log, but it's huge and has line lengths up to 7000 odd > chars. I'm not sure that I would notice if there was something amiss. Ooops. I should have said 'line lengths up to 70,000 odd chars'. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 17.04 Booting into the Shell Instead of the Desktop
On Sunday, 30 July 2017 12:08:15 BST Ralph Corderoy wrote: > > Everything has been fine for a while, but in the last few days, it > > boots into the shell instead of the desktop > > Every time? You normally have it boot into a logged in user on the > desktop? Or a graphical login prompt? Not at first, then it was every time, but since I wrote this query it's worked every time. When it boots up OK, it tends to shut down OK. No it don't have it boot straight into the user, but I do normally get the graphical login prompt. > Have you a package-upgrade log you can look at to see what might have > been updated just before the fault? /var/log/apt perhaps? There is a History log, but it's huge and has line lengths up to 7000 odd chars. I'm not sure that I would notice if there was something amiss. > Probably. Does `lsmod | grep brcmf' show any output? Google suggests > that a wifi module starting with that name can cause problems on Dell > XPS; what's your model? No. Nothing. > Poke about logs. There's `dmesg' which is the kernel booting and then > any later kernel messages. /var/log may have interesting ones, and then > journalctl(1) came along and snaffled many of them. I did have a look at the kernel log, but didn't see anything that looked relevant. Of course I don't really know what I'm looking for > Try using the https://en.wikipedia.org/wiki/Magic_SysRq_key to enter > "busier" backwards instead. If that works then one of "d", "l", or "w" > after the "b" might show useful information. I'll give it a try the next time it happens, but it doesn't seem to be reading the keyboard at all by then. I tried Alt Ctrl F1 to get a virtual console, but nothing happened. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - One Week Tonight
Hi, The next meeting is just one week away at the Broadway, Bournemouth at 20:00 on Tuesday evening, 2017-08-01. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? Your turn to drive I think. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Downloading Code from Github
Hi, Is there a 'proper' way to grab a copy of a program from Github without making a Pull Request? Previously, I've downloaded the whole repository and just grabbed the code I wanted, or read the file Raw and done a Save-as. Is there another way? I've always avoided making a Pull Request because I didn't intend to change the file, just use it, eg to try it out. (Also, in the past I've not had sufficient access to the repository to do a Pull anyway, but now I do.) I want to get hold of a copy of a program recently committed by one of the WMT team to test it on the hardware. Clearly if there is something wrong with the code, I might want to Pull it to fix the problem, but equally, I might want to raise it as an issue. My experience of Source Control Systems is limited to two; SourceSafe on Windows and DSEE on HPUX thirty odd years ago, but I always believed that you only 'checked-out' a file if you intended to change it. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Using Github as a Bug Tracker
Hi, We've created a Github Repository for the Wimborne Model Town software and have made some commits of software currently being tested there. One topic that came up for discussion is the tracking of bugs. Prior to this year it was all done by emails (very clunky) and more recently through the WMT Project Forum which is better, but not really designed for the job. Now I have a Github account I notice that the 'Issue' tab can be used as a bugtracker. I've skimmed through the Help and it looks as if this would be ideal for us. I'm sure many (most?) of you who develop for a living use Github, so what do you think of the Github Issue capability? Would it be helpful for us or could it create more problems than it's worth? The team at the moment consists of one young and very able IT student, me, one ex engineering manager / hardware developer and Clive. The internal users are the Manager and staff of the WMT and possibly some of the other volunteers. Any thoughts? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-08-01 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Fwd: Re: Backups - what else do I need to do?
Curses, my mailer sent the forwarded message as an attachment On Wednesday, 28 June 2017 14:14:04 BST PeterMerchant via dorset wrote: > The main reason for doing backups is in case my system goes bang I can > restore it. In the past I have been lucky when I have reinstalled > kubuntu 'over' the old version. When I rebuilt the other computer > from XP to kubuntu, even though I had backed it up, I discovered that > not everything got backed up - like my firefox bookmarks. Peter, I've always gone for an incremental backup program; currently Simple Backup Suite (http://www.techradar.com/news/software/applications/best-linux-backup-software-8-tools-on-test-909380/3). It's in the (K)Ubuntu repositories and 'just works'. I've only had to restore a complete system once, but I don't recall having any 'missing bits'. It will take the contents of your /home directory (or any other that you specify) and compress everything into a tarball. The next time you do it, it will only take the changed files until it's time to do another full backup. For restoration, you get a calendar from which you can select the most recent backup that contains what you want (you may have intentionally deleted something three weeks ago, which you now find you want.) To limit space on the destination drive, you can specify the period that backups will be retained before being purged. I tried various backup software over the years, but this one has met my requirements fully since it arrived on the back of a Google 'Summer of Code' some years ago. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - One Week Tonight
Hi, The next meeting is just one week away at the Broadway, Bournemouth at 20:00 on Tuesday evening, 2017-07-04. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? My turn to drive. (It really is this time.) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Last Night's Meeting
On Saturday, 24 June 2017 13:10:34 BST Ralph Corderoy wrote: > Raspberian has picked the Thonny Python IDE as the one they're pushing, > rather than IDLE. Should be a package-install away. http://thonny.org/ It's now in the Repository, as of yesterday. Also available this time is an installable version of Raspbian for the PC. I installed it on VMWare, but I've not been able to get the machine to run with a resolution of more than 640x480, but it does run. Thonny looks nice. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] YAWMT Question
On Thursday, 22 June 2017 13:23:35 BST Ralph Corderoy wrote: > I'm assuming that minimising power consumption won't be an issue either > way. Obviously we won't want to install a heavier sub-station for the WMT, but no; we have no known issues with power ATM :-) > I'm guessing slave Pis will only be in the dozens, and readings and > all-hands-to-the-pump commands in the order of 1 Hz or slower? Essentially correct, although the initial installation won't include dozens of slaves (apart from the volunteers :-) ). > That's sounding as if you'd have a database server sitting on the > network with all the slave and the master being its clients, sending SQL > to modify tables. And if the slaves are writing to the tables, and the > master is trailing behind, reading them, then you're (mis-)using the > database as message queues. Perhaps a message queue would be a better > fit. OK. I've vaguely heard of message queues. > As Tim said, it sounds like overkill, and adds another major piece to > understand, configure, monitoring, debug, ... A message queue, like > RabbitMQ, or zero.mq, also has those problems given your simple needs. I'll look into those. > You're sticking with Python? And you've been dabbling with > http://flask.pocoo.org/, the web micro-framework? I'd try and stick > with those. Python has been adopted as the preferred language for WMT software by consensus. (Despite the fact that I had to fall back on C for the lighting software due to lack of Library support for hardware PWM in piCore.) I haven't done much with the flask stuff yet, due to 'one damn thing after another' on the home front. The web updater for the Audio Guide / Quiz was always a 'Desirable' rather than 'Essential' feature, so I'm focusing on fixing the blocked drain, broken tumble drier, central heating always on issues at home and trying to keep up with the River System development during odd bits of spare time. > How about having the master poll the slaves regularly, with a timeout. > That way it learns of slaves not responding. The slaves present a web > server that sends back the last-obtained readings when asked; GET > /readings. The same web server can provide a path for writing by the > master; POST /pump-speed. In the slave, you'd have flask manage > calling your bits of code to format the variables holding the readings > into the text reply, and parsing the new speed out of the text request. > Something like the APScheduler you're already familiar with can > regularly call your routine that reads the Pi's I/O. To safely stash > those readings from variables local to the function to those shared with > the web-serving side, look at > https://docs.python.org/2.7/library/threading.html#lock-objects to > provide the https://en.wikipedia.org/wiki/Critical_section Tim > mentioned. Thanks. I'll look into that. We want a webserver in the system anyway to provide a control panel for the WMT staff and an information panel for the visitors. Maybe I'll understand enough about flask by the time we've finished to get the web updater done :-) > (IIRC storing a value in a Python global doesn't need a lock, so you > could have a global holding all of the readings, and switch them > wholesale for a new lot with a single atomic STORE_GLOBAL opcode, but > it's simpler to tell you to use a lock. :-) I'm sure that when I've read up on all this, I might understand what you're telling me ;-( (It's the documentation that I have a problem with and that's mainly due to my lack of knowledge of the terminology used in the CS world.) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] YAWMT Question
On Thursday, 22 June 2017 12:17:56 BST Terry Coles wrote: > I'm not sure that I understand how this works. Taking the Remote Pi; it > reads the water level and writes the value to a variable. Fine so far, but > how can the Master Pi, then read that variable? That variable is a > location in the Remote Pi's RAM, so is inaccessible to another device. Thinking about this a bit more; clearly the Master Pi can get access to the Remote Pi's variables through SSH, but wouldn't it then have to maintain multiple SSH sessions? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] YAWMT Question
Hi, (Yet Another Wimborne Model Town Question) :-) The system design for the WMT River System Water Sustainability Programme (that really is its name) is progressing slowly and we have tentatively agreed on a number of things. The control system will be a distributed network of Raspberry Pis, interconnected by Ethernet cable (we are trialling Power over Ethernet to see if we can power the remote devices without needing mains local to them). Each device will be responsible for taking one or more measurements of water depth, flow, etc and, in certain locations, for controlling pumps. My question is about distributing data (eg measurements and speed demands). There will be a master controller orchestrating everything, so we need to get measurement data from the Remote Pis to the Master Pi and possibly pump speed demands the other way. As a systems engineer my instinct is to use a central database which each of the Pis can write to or read from. So for example, a level measurement value gets written to a record and the Master Pi reads that record to use when determining if a pump speed needs to be changed. The Master Pi then writes the speed demand to another record, which the Remote Pi reads and acts upon. My reasoning for selecting a database is that there won't be problems if a Remote Pi is trying to write to a record at the same time as the master is tring to read it, plus, I believe that it should be possible to do all these transactions over the Ethernet link. However, my knowledge of database functionality is very much at the systems level, so before I embark on a programme of research, does anyone have any comments on this approach? If there is a better way, I'd like to hear about it. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Last Night's Meeting
On Wednesday, 7 June 2017 12:48:10 BST Ralph Corderoy wrote: > Terry was finding pylint disliked how he named his global variables. > https://www.python.org/dev/peps/pep-0008/#naming-conventions was > mentioned. It seems to say lower_case_with_underscores for those. Yes. I see that. Interestingly, I could see nothing about local vars, although his examples seem to use the same convention as globals. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Last Night's Meeting
Hi, We were a bit sparse last night with only five of us, but there seemed to be plenty to discuss. I missed quite a bit from the other side of the table (Paul was trying to configure OpenMeeting on our side), so perhaps someone can fill in some of the blanks. What I did catch though was the discussion about Python IDEs and the Eric tool. I'd never even heard of it but I've just installed it on this machine and I have to say that this is more like the tools that I was used to using when I was still working. The debugger and Python Shell are built in (as with IDLE) but there the comparison stops. Unlike IDLE the debugger actually seems to work (as far as I can tell ATM). I haven't tried on a Pi yet (it seems to be in the repository) so I haven't used it in anger much (RPi software generally needs the GPIO Libraries which aren't available (or any use) in PC Repositories). Picking up on Ralph's comment yesterday about debuggers getting in the way of real work, I can see that a novice programmer might find the learning curve quite steep for this tool. As a 'semi-novice', I at least know what a debugger is trying to do, but I think it will be worth the investment to learn the ropes. On that note, there is one downside - the documentation seems to be extremely comprehensive, but a bit daunting as it's a 294 pp PDF ;-) Anyway, I thought I'd convey my first impressions in case anyone else hadn't come across this tool. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-07-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Error in Python - UnsupportedOperation: fileno
On Tuesday, 6 June 2017 14:13:49 BST Ralph Corderoy wrote: > > That's all very well, but debugging is much harder, especially for > > relatively novice programmers, such as one major segment of the Python > > community; the kids (and me of course). > > I think teaching kids to learn to program depending on a debugger is > wrong. It's a crutch that impedes their learning of logical thought and > how to use the language to get the information they need. But these kids aren't learning to be programmers :-) I think this is where half the world has got it wrong. Yes. Eben Upton developed the Raspberry Pi to increase the uptake of CS courses at Cambridge, but it is way beyond that now. Some will go that way, but the main goal is to teach children (from Primary through to Upper School age) to think about how things work. If you make it too difficult, they'll lose interest. > > I remember debugging C in the shell around 30 years ago. It was very > > tedious and everyone welcomed proper debugging environments, such as > > Turbo C. > > Not this "everyone". :-) I do use a debugger for examining a static > snapshot post mortem, e.g. core dump. That's mainly because I want to > poke about the register and RAM values, and what machine code is pointed > to by some of those. > > The rest of the time I follow this advice. > > The most effective debugging tool is still careful thought, coupled > with judiciously placed print statements — Brian Kernighan. Yes. That's what we did 30 years ago and we got there in the end. It is very useful though to see the content of variables on the fly and view all the error messages and Warnings as they occur instead of trying to unpick them after the event. One thing I used a lot was to change the content of a variable as the program ran, so I could check the path through the code more easily. > Python aside, there's lots of Unix ways to debug without using an > interactive debugger. ltrace(1) shows library calls, including > backtraces with -w. strace(1) does similar for system calls, and can > inject failures which is useful for testing, e.g. the 42nd read(2) will > return EBADFD. lsof(8) shows opens files and /proc/$pid gives lots of > useful info. gprof(1) can show profiling information for hot spots, > perf(1) can uses the CPU's counters for instructions, etc. valgrind(1) > spots memory access errors. The trouble with these is that interpreting their output requires a lot more skill and understanding of the underlying code; something that High-Level languages like Python were supposed to minimise. That's why we don't all write our programs in 1s and 0s :-) > And if all else fails, print the information out and post-analyse it > with a little awk(1); a custom throw-away debugger. Another tool that takes some skill to understand. > The problem is the GUI would have to jump through some > non-cross-platform hoops, e.g. posix_openpt(3), to make the Python > program think it was talking to a real TTY by asking the kernel for a > pseudo-TTY to plumb up to stdin, etc. That's what xterm(1) and others > do, as tty(1) shows by the `pts' in /dev/pts/42. OK. I see why the GUI didn't work, but other GUI IDEs that I've used on Windows do manage this somehow. At least I don't recall having these sort of problems, but maybe I never quite tried to do this. > Instead of reading a key, you could regularly test if file ./key-inc > exists, or ./key-dec, or both, and adjust your PWM duty. Those two > files can be created and deleted outside of IDLE by some other means. > Either you with touch(1) and rm(1) in a shell, or a shell script that > creates a file for a second, then deletes it, etc., to give a test > script. I've got the software working now thanks. I used the thought and print statement method :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Error in Python - UnsupportedOperation: fileno
On Tuesday, 6 June 2017 11:21:19 BST Ralph Corderoy wrote: > How are you running detectkeys.py? From the shell, so it has its > sys.stdin connected to the TTY? Or from some weird GUI IDE thing? :-) I was running it from IDLE, which is the standard IDE for Python recommended by most Python books and sites that I've seen. The software works in the shell. > My guess? Learn to love the shell. :-) That's all very well, but debugging is much harder, especially for relatively novice programmers, such as one major segment of the Python community; the kids (and me of course). I remember debugging C in the shell around 30 years ago. It was very tedious and everyone welcomed proper debugging environments, such as Turbo C. I have to say that I've always thought that IDLE wasn't the best IDE in the world, but if it's going to introduce problems of it's own then it's time a better environment for Python was found. When I was building the PWM software for the Lighting Project in C, I used Geany and I've just discovered that it has a Plugin for a Python Console, but I couldn't see how to run it and I couldn't see a debugger. I'll have to have another look. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Error in Python - UnsupportedOperation: fileno
Hi, On yet another phase of WMT developments, I've hit yet another problem. I have a working PWM program to control the speed of the pump that circulates the water in the Model Town's river system. The current program uses two buttons connected to GPIO inputs to control up and down. However, during testing, we will have to use a monitor and keyboard to see what is going on, so it's been suggested that the program should simply use keypresses. I hadn't seen any Python examples of trapping keypresses, so I searched the web and found several examples; the simplest of which may be found at: http://www.jonwitts.co.uk/archives/896 The problem is that when I run it I get: Traceback (most recent call last): File "/home/terry/Development/Python(General)/Detect_keypresses/ detectkeys.py", line 21, in char = getch() File "/home/terry/Development/Python(General)/Detect_keypresses/ detectkeys.py", line 8, in getch fd = sys.stdin.fileno() UnsupportedOperation: fileno This happens with other examples that I've found and on this machine and the Pi. I've been to look at the documentation for sys.stdin at: https://docs.python.org/3.5/library/sys.html?highlight=sys.std#sys.stdin but can see no reference to a method called file.no. Is this a standard method available in all relevant Python objects? In other places, I've found references to fileno, but not to my specific error and in any case, the context is wrong. So what am I missing? This code would appear to work for others (I see no comments saying it doesn't anyway), so why doesn't it work for me? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - One Week Tonight
Hi, The next meeting is just one week away at the Broadway, Bournemouth on Tuesday evening at 20:00; 2017-06-06. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? My turn to drive. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Help on home play project
On Sunday, 28 May 2017 11:26:47 BST Terry Coles wrote: > rather than turbines have gained some prominence. There was once a water > mill on the River Allen (in Mill Street would you believe) although that That should be Mill Lane of course. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Help on home play project
On Sunday, 28 May 2017 11:24:21 BST you wrote: > Mustn't forget the need to have it hidden from the visitors as it is not > a feature of the town. Horizontal paddle wheel under a bridge perhaps? Crossed over with my last post! -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Help on home play project
On Sunday, 28 May 2017 08:47:09 BST PeterMerchant wrote: > Ok, so you have already looked into this sort of device. It does have > some show-stoppers. I am not a fluid dynamicist, though I did have some > of it in a course once, so any thoughts need thinking about. None of us are fluid dynamicists either, but we have been looking at this for some months now. Apart from that, I learned from bitter experience as a systems engineer to check and double check the specs *before* I bought anything :-) > How about a larger prop blade so that junk and detritus will go through > it, and only partly submerged so that the generator/transducer doesn't > get wet? I think it would probably need 6 blades so that enough of a > blade is still in the fluid to cause it to turn. And then calculations > to figure out the flow, which would also need the height of the water to > be taken into account. > > Ah Heck, you've probably got a simpler solution. We haven't got any solutions yet, just several ideas. We have aesthetics to consider as well as functionality, so solutions based on paddle wheels rather than turbines have gained some prominence. There was once a water mill on the River Allen (in Mill Street would you believe) although that was gone by the 1950s when the Model Town was constructed. Another alternative is to tether a paddle boat midstream. Whatever we use, we will probably pick off the rotations using a hall effect sensor or optical device such as the one Peter W identified the other day. I personally like the optical route, but we'd have more problems with the ingress of dirt with that, so the hall effect sensor may prevail. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Help on home play project
On Saturday, 27 May 2017 22:17:10 BST PeterMerchant via dorset wrote: > Thinking about Terry's water flow, a different sort of transducer is > required, and I found this: > http://www.globalw.com/products/flowprobe.html I just kept thinking > about Brunel's test of a screw versus a paddlewheel. When a company requires you to fill in a form so that they may 'discuss pricing' it's time to head for the hills! I never used to fill in those forms even when I had a commercial budget to play with. > This looks much better! > https://www.amazon.co.uk/1-30L-Water-Sensor-Flowmeter-Control/dp/B00NGFOLUG/ > ref=pd_bxgy_60_img_2?_encoding=UTF8=1=BQAYJCMWAJCZ5P1D4VCN Yes. we've seen those, which are designed to measure water flow in a pipe. They are frequently used in washing machines and dishwashers. Our problem would be getting the water flowing in a 'bed' with a cross- sectional area of ~ 0.15 square metres to travel through a tube with a cross- sectional area of 0.0003142 square metres in a meaningful way. If we forced it all through the pipe, it would restrict the flow considerably, if we simply put it into the 'river' then the first bit of leaf that came along would block it! That's not to mention that these things are designed to run dry on the outside, run vertically and have a flow rate up to 30 litres / min at a pressure of 1.75 MPa through that tiny pipe. (1.75 MPa is 250 psi by the way :-) ) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Help on home play project
On Saturday, 27 May 2017 12:11:10 BST PeterMerchant via dorset wrote: > Does anybody know anything about disc drives? The other suggestion I > have seen is to use a bike speedometer hall effect sensor to capture the > rpm. I don't know anything about disc drive motors, but I would have thought that you would have to rotate them pretty quickly to get a usable output, since they typically run at 5400 or 7200 rpm (that's a minimum of 90 revs / sec). By the time you geared the motor down to the speed of the cups, you will be taking quite a lot of energy from the system. We are currently looking at measuring the water speed in the 'River Allen' at the Model Town. So far, the best suggestions have been to use hall effect devices or opto-couplers on the end of the shaft. Apart from the friction in the bearings, neither of those methods will contribute much to losses. I can send you more info off list if you like, but we haven't got too far with our design yet. It will probably need a Schmidt trigger or similar on the output of either type of device to get the signal amplitude up to 3.3 V for the Pi (and yes we will be using a Pi). > I have glued 'cups' to the disk and it turns freely, I also need to find > a place where the wind is constant around here. Good luck with that around here. I would use an indoor fan to get a constant speed to test the device initially. > Then I'll feed it into a R-Pi and make the output readable. Have you got access to a scope? You will be working in the dark if you don't know what the O/P looks like. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Message for Peter Merchent - Thermal Paste
On Thursday, 11 May 2017 12:29:07 BST Ralph Corderoy wrote: > lug.org.uk is handing emails to Peter's server and it's accepting them > happily. > > That error above is Peter's talktalk complaining that the server handing > it the email on *your* behalf is blacklisted from talktalk's point of > view. http://helpbusiness.talktalk.co.uk/blacklisted-ip-address It would have been useful if the Error message had listed the IP that it didn't like; I would then have been more likely to understand. > The full rejection may give more detail, but from the headers on your > emails to the list I assume it's 217.72.192.75, mout.kundenserver.de, > that appears in DNS RBL and others. > https://mxtoolbox.com/SuperTool.aspx?action=blacklist%3a217.72.192.75=to > olpage Looking at the header from the error detail, I get: --- The header of the original message is following. --- Received: from optiplex.localnet ([51.6.33.83]) by mrelayeu.kundenserver.de (mreue004 [212.227.15.163]) with ESMTPSA (Nemesis) id 0MOmdm-1d3nSU1mgo-0069aS for <madsmad...@talktalk.net>; Thu, 11 May 2017 12:24:52 +0200 So, either the TalkTalk Mailserver is rejecting my message because it doesn't like my IP Address optiplex.localnet ([51.6.33.83]) (this is listed at spamhaus) or it doesn't like One and One's Mailserver (217.72.192.75, which is listed on no fewer than four blacklists. You will recall that Paul's mailserver rejected my PCs IP, so it's not unheard of. This is getting monotonous. I suppose I could change my hosting company (I have a SOHO package from One and One), or I could complain bitterly to One and One, which will probably not help. I suspect that One and One, being as large as they are, get this frequently and just as frequently sort it out. This would explain why emailing Peter is so hit and miss; I've had issues before, but emailed him successfully only yesterday. I also get similar symptoms when I email Tim. Presumably the mailservers at their ISPs are more stringent in applying blacklists than everyone else. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Message for Peter Merchent - Thermal Paste
Peter, I tried to send the message below by replying to your message to me. My Mailsserver, gave the following error: A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following address(es) failed: madsmad...@talktalk.net: SMTP error from remote server for GREETING command, host: mx.talktalk.net (62.24.202.42) reason: 554 cm12nec mx.talktalk.net 8lHAdGABweJFS IP Blacklisted (TT102) I've seen this before when trying to mail you, but the problem is intermittent. Here is what I wrote in reply to your original message: On Thursday, 11 May 2017 11:06:35 BST you wrote: > Hi Terry, did you send it "to be signed for"? The postman has left me a > note about a parcel that I'll have to collect tomorrow and I can't think > of anything else that I am expecting. No. I just put it into an envelope and put a 1st Class stamp on it. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 16.10 -> 17.04 Update/Upgrade Issue
On Thursday, 11 May 2017 11:04:40 BST PeterMerchant via dorset wrote: > On 30/04/17 13:06, PeterMerchant via dorset wrote: > > On 19/04/17 10:16, Terry Coles wrote: > >> My copy of Kubuntu 16.10 (and earlier versions) has always had an > >> issue with the graphical update tool (it never notices that there are > >> any). This is a known bug which the Kubuntu team seem unable to fix (they > >> did once then changed the updater and broke it again). > Hi Terry, did you ever get this working? On the 'new' home K16.04 > computer I never seem to get any notice of updates. Muon was not > installed as part of the package, it had 'discover'. After I did an > 'sudo apt-get update' which failed because of some skype repository > problem, I had the little Update Icon on the taskbar. I was wondering if > these were related- the fact that I stimulated it, and then it noticed? You won't on 16.04, because, as mentioned above, the bug was there for years before that version was released. If you visit the Kubuntu Forums, you'll find a very long bug report which reflects the mounting frustration by the users as the Kubuntu team 'mended' the updater, only to break it again. My name appears more than once. It started with notice of updates arriving normally; flagging up 1 to many updates available. At that stage the updater couldn't count and the actual number was always different, including no updates at all. This was flagged as a bug. Next they fixed that, but the updater stopped telling us about new updates. Then finally, in 16.10, they would tell us occasionally, but then deny all knowledge of the updates when the tool was run, even though they were there. > At the moment I can't seem to find the settings for when I want updates. > There is no menu item for it as on this machine. Both computers are > Kubuntu 16.04. The only fix that I'm aware of is to upgrade to 17.01. Updating is now handled by the 'Discover' Software Centre which still has no useful settings. At least it works, although I use only use it for updates. I use Synaptic for installing new software because it has a far better search capability and lists every package, not just the ones that Canonical think you should know about. (What this means that it doesn't list any libraries and only some command line tools. You can find them if you know what they are called and search for them, but even that is broken. If you try to search for 'bash', it will immediately leap to packages beginning with 'b' and then only find it if it is in the subset that it has listed.) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Friday, 5 May 2017 15:47:33 BST Ralph Corderoy wrote: > Again looking at it back to front, the simulation could help determine > the limits of the real-world that can be handled. Since the Pi has a clock speed of 700 MHz +, depending on the model and everything else is analogue, I think it's unlikely that the control system will be unable to handle the limits of the real world. We are looking at response times of 10 minutes or more. Of course if the real world signals turn out to be too small or too large, then there will be issues, but we'd need the real world to determine that. > That sounds very complex compared to sloshing a bit of water in by > opening the valve for a short while, then refusing to do so again in the > face of demand until N seconds have passed to allow it to work its way > around and maybe flip some level switches. This copes with the system > changing over time due to parts being replaced, pipe bores reducing with > debris, etc. Well we could do that, or we could calculate the rate of change of flow and the rate of change of levels and then ramp up or ramp down the pumps accordingly. That is *much* more complex and *much* more fun. I see no reason why we shouldn't be able to do that though unless the sensors let us down. > Anyway, it sounds like it will be fun however you tackle it. > Another Pi-magazine article? :-) I'm still waiting for Rob Zwetsloot to visit to look at the Bells. He promised he would about a month ago. To be fair, anyone who has bought the latest copy of MagPi can probably guess why. Preparing for this month's freebie must have taken up quite a lot of his time. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Friday, 5 May 2017 13:55:03 BST James Blake wrote: > When I've seen similar things done in industrial control networks you > typically create a software sandbox similar to that described in order to > define the programmable logic controller commands. I have experience of using similar systems (as a systems engineer rather than as a software engineer). The biggest problem that we encountered was simulating the real world parameters in a realistic way. For example. Our river system is likely to have a maximum head of water in the 5 water butts totalling about 1000 litres at a height of around 1-2 metres above the sump. As the water drops in the river system, then we want to turn on this supply at the right rate to top-up the river without overdoing it. In order to simulate that, we need to know how long it will take until the sump is full when we shift (say) 100 litres of water from the butts. That will depend on the size of the pipes, the smoothness of the internal bores, the slope, the depth of water in the butts, the pump capacity and the kinks in the pipework. We can estimate this, but in the end it will only make sense in our model when we have some real figures to plug in. Simulation is an excellent tool for developing control systems but in the real world you need an injection of reality (literally) to actually do more than reinforce your preconceptions. Generally, engineers developing control systems have previous system parameters to use as a starter for 10. None of us on this team are control engineers, hydro engineers, environmental engineers or have any experience of river systems other than falling into them when small. What we have is me (a retired systems engineer), a retired engineering manager with a background in electronics and an IT student. We are going to take this slowly. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Friday, 5 May 2017 13:37:02 BST Ralph Corderoy wrote: > > Thanks. I'll look into that, although I doubt that we'll be writing > > software for some time. We need to get the system design nailed down > > first and we can't do that until we've built and tested some sensors. > > That seems quite a strict order to progress. Build and test some > sensors; levels, flow, ..? Repeat until they work. Design a theory of > how they can be used. Make enough sensors and put them in planned > positions. Have Pi gather data. Implement logic. Work out how far to > backtrack and re-do based on problems found. The thing is that we're not short of time; the project is a phased one with the automation being tackled in Phase 4. Phase 1 is now complete and Phase 2, (the bog garden) is well on the way. Phase 3 has been started; that is putting in the water butts and it really makes little sense to rush into Phase 4 until we have something to control other than the sump pump! The last Phase (No 6) may not even be started for a year or two. The labour for this job is free, but a bit scarce because a key resource is extremely tied up with his OU course at the moment. What is not free is the cost of the materials, so we want to have some confidence that we are buying the right kit before we spend WMT funds on more than a few parts. The big Risk is environmental as far as we can see, so the first thing to tackle is confirming that we can overcome that problem. Then we can look at how we can best use the selected sensors in a system that includes software. > Or, model system to see what minimal simplest sensor allows the desired > result, e.g. binary "water at my level" switch, no flow. Logic is > continually varying the pump PWM as it responds to these flipping > switches in a "plate spinning" up-a-bit, down-a-bit, scramble to keep > feet dry and attain equilibrium. Some "emergency off" or "all hands to > the pump" switches could override the river-level ones. The river flow > might undulate a bit, though that could make it more interesting to see. We believe that the biggest risk to the Project is the sensors. I don't think we see the control side of the system as a major show-stopper. Yes it could take us a while to work out the right algorithm and we may have hiccups along the way, but we don't anticipate that we won't get it to work - eventually. The thing is that the control system will have a very long loop time constant. We will be monitoring water levels at intervals of minutes rather than milli-seconds and ramping up the pumps very slowly to compensate for leakage or flooding. > No idea if that could work, but software simulation seems an easier way > to experiment, or a system could even be "run" on paper or a spreadsheet > with rows being time-passing "ticks". I'm sure you are right and I expect that we will do something like that. I would like to know what the inputs and outputs of the system are going to be before we try to simulate it, that's all :-) > Playing around in the water with sensor design could be in parallel, if > only there was enough volunteer time. :-) Exactly. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Thursday, 4 May 2017 17:26:41 BST Ralph Corderoy wrote: > If the control logic looks like being at all complex you'll probably > want to simulate the system all in software; your control logic versus > random events/you acting as the gods. When I was writing Python, I used > its TkInter GUI library to do something similar. That provided all the > controls to control the simulation, display readouts, etc., but best of > all was its Canvas widget to draw a schematic. This lets you plonk down > bits of drawing and text, give them "tags", and then change all things > with a given tag, e.g. colour, and it takes care of the redrawing. In > my case, it was all the lines representing one logical wire, etc. > > https://wiki.python.org/moin/TkInter Thanks. I'll look into that, although I doubt that we'll be writing software for some time. We need to get the system design nailed down first and we can't do that until we've built and tested some sensors. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Thursday, 4 May 2017 16:52:49 BST Ralph Corderoy wrote: > Does the sump at the bottom of the river have the capacity to cope with > no power for the pump that takes the water back uphill? Perhaps it > overflows into a drain? If not, I guess the pump runs continously or > the river flow is shut off at the top with the bog garden able to absorb > a lot more if it's not a sudden increase? Would seem a lot simpler if > it was a closed system, not open to the rain. :-) Err. That would be a bit difficult since the attraction is completely in the open air. (Yes I did see the smiley.) The sump would flood if too much water got into the river. Historically the old system was shut off overnight or in the off season, but otherwise consumed a lot of water from the mains due to leaks. To save money and the environment, the leaks have been largely stopped reducing the water loss, but also increasing the risk of flooding. During dry periods however, a top-up will still be needed and the goal is to supply that water from the butts, with any excess being made available for watering the gardens. If the excess exceeds the demand then we will have to dump the water somehow. Of course during a real drought, we would then have to fall back on the mains. Part of the control system will include varying the amount of water pumped from the sump to the bog garden by using a PWM drive signal to the pump motor. In order to do that automatically, we need to know the level of water and the flow at various points around the system. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Thursday, 4 May 2017 16:20:48 BST Patrick Wigmore wrote: > I must admit, it surprises me that the river system is so > sensitive to the weather conditions. I would have expected there > to exist a constant pumping rate that would maintain the river > between sensible high and low levels except in very extreme > weather. Well, before this year, when the bog garden was added, this is exactly what happened, except the volunteers or staff had to top-up the system to compensate for leakage and evaporation. Floods were quite rare, because the catchment area was very small. > But then I have assumed an 'ideal' river and sponge-like bog, > both with no leaks into the ground, and a sump tank that can > easily hold the entire volume of water when the pump is switched > off and the system drains down. It sounds like the reality is > more complex. This is the first year that the catchment has increased due to the addition of the bog garden, but even that won't make a lot of difference I suspect. However, once the rainwater collection scheme is in place with five or more water butts to store the water, then the risk of floods will be increased after periods of heavy rainfall. In the end, the monitoring and control is more about that scenario than the present one. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Wednesday, 3 May 2017 18:15:34 BST Andrew wrote: > In case you didn't already know, 'digital' versions of these are > available quite easily and probably cheap, or free. They are used in > most if not all washing machines and dish washers. The one I've looked > at recently has a screw for pressure adjustment. You could get hold of > at least two of them (one for "too high" and one for "too low") and > connect them to GPIO pins if exact water height doesn't matter. Since the system will be running largely unattended 24/7, we want to be able to predict the onset of a flood or drought in the river. To do that we need to measure the actual depth so we can determine the rate of change. We can do that a number of ways; an air pressure sensor for depth; a load-cell for weight or an ultrasound detector for distance to the surface are all under consideration. They will all will give a linear output between empty and full. We have considered a cluster of probes to signal when various levels are reached, but we currently prefer the pressure, weight or ultrasound approach to give a continuous reading. (This will also be better for the educational side of the project, since the Visitor's display will show the actual levels and flow around the system.) > If the problem is making sure the water is pumped from the lower tank to > the header tank, but the pump is turned off when the header tank is full > or the lower tank is empty then there's some quite simple ways to do > that. But they don't require a computer so aren't perhaps technical > enough for this list. :) It is more complicated than that. Not only do we want to control the pumping of water to the header tank (the bog garden), we also want to control the flow of water in and out of the butts. > Also, I wrote my last e-mail before I had looked at the Wimbourne Model > Village web site. I imagined it would be indoors and a lot smaller than > it is! Yes. The Model Minster is too tall for me to work on the Quarter Jack without a ladder! -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Monday, 1 May 2017 12:26:09 BST Terry Coles wrote: > Has anyone ever done anything like this? Ideally, for level, an ultrasonic > sensor with a good level of water resistance would be ideal (it won't be > immersed, but it will be exposed to rain, mist etc). The capacitive sensor > requires RF, which brings it's own issues and the other types may provide > readings that are too coarse to monitor rate of change of level. > > I haven't found anything much yet that will give us flow measurement in a > 'river'. The commercial types tend to be fairly cheap but designed to go > into pipes. However, we should be able to come up with something using > hall effect sensors, so I'm more interested in level at the moment. > > Any ideas, links to projects that have done this? A quick update on this: As I mentioned at last night's meeting, we are currently considering a solution based on measuring the air pressure in a pipe that is connected to the bottom of the butt. Obviously when the tank is empty the sensor will measure 0 kPa (as compared to the atmosphere) and when it is full it will measure the pressure due to the height of the water column, which I calculate to be up to 15 kPa in a 200 litre butt. Also, someone on the Raspberry Pi Forums has suggested using a load cell to weigh the butts. I'm still looking at that. Both solutions are based on the 'strain gauge' type of sensor, so the output voltage tends to be rather low (typically less than 30 mV). This would require us to design some low noise circuits to amplify the signal to the level where it can be converted to digital for the Pi to process. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Wednesday, 3 May 2017 10:55:36 BST Ralph Corderoy wrote: > > If you go to http://explorer.geowessex.com/ and enter the WMT's > > postcode (BH21 1DY), the map will show the Model Town. Then go to the > > Layers control, turn on Flooding; Floodzones 3 > > There's a `Share' icon in the right-hand side. I've been using this tool for years and never noticed that ;-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Wednesday, 3 May 2017 08:08:37 BST PeterMerchant via dorset wrote: > On 02/05/17 22:18, Tim wrote: > > Could be interesting if the Rivers ever flooded Wimborne having to get > > the model village replicate the situation, sorry a bit OT there, just > > my warped humour coming out. > I think that it would automatically happen. The Model Village is > virtually on the flood plain by Wimborne. Actually it's not. If you go to http://explorer.geowessex.com/ and enter the WMT's postcode (BH21 1DY), the map will show the Model Town. Then go to the Layers control, turn on Flooding; Floodzones 3 and you will see that the flood plain goes round the Model Town. Even the 1 in 1000 year layer doesn't really touch it. The main floodzone follows the River Stour with much smaller floodzones around the River Allen. The model town only includes the two branches of the River Allen within its boundaries. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] A New Wimborne Model Town Project Query - Sensing Water Levels and Flow
On Tuesday, 2 May 2017 21:45:46 BST Andrew wrote: > It looks like the real rivers are being monitored in at least two places: > > https://www.riverlevels.uk/river-stour-oakley-wimborne > https://www.riverlevels.uk/river-allen-colehill-walford-mill > > As a model town I would be tempted to find out how they are doing that > level monitoring and then make a miniature version in the correct places > on the model. Unfortunately, neither of those places are within the are encompassed by the model town. Also, I suspect that the Environment Agency or whoever does the monitoring on the real rivers can afford to spend just a little bit more on their sensors than we can. > Is the monitoring just to control the river flow? Does it need to be > more complicated than a header tank and a valve for each river entry > point to control the flow rate? The monitoring has two functions. Fundamentally it is to control the level of water in the in the 'river' (and therefore the flow). In the past, the river has 'flooded' when there has been a lot of rain or when an over enthusiastic volunteer forgot to turn the tap off. The main goal though is water sustainability. We want to catch rainwater in the butts and then pump it in and out of the river automatically, hence the need for extensive monitoring. It has been pointed out that this project is a bit 'over-the-top' for a few tens of metres of water channel. However, when finished, the workings of the control system will be made available for visitors to view on a monitor; the idea being to enhance the education value of the attraction. > Once you collect the water at the end of the river it can then be pumped > up to the header tank until it is full. That is effectively what we have at the moment, except that there is a sump at the bottom of the river system and a bog garden at the top. Water is pumped manually from the sump to the bog garden and the whole thing topped up from time to time when water is lost due to leaks and evaporation. They have no way to combat flooding at present. > For extra complexity, get the water level of the real rivers from > wherever the above web site gets its data and adjust the levels of the > model rivers accordingly... Now you're pulling my leg :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-06-06 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - One Week Tonight
Hi, The next meeting is just one week away at the Broadway, Bournemouth on Tuesday evening at 20:00; 2017-05-2. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? My turn to drive. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 16.10 -> 17.04 Update/Upgrade Issue
On Wednesday, 19 April 2017 09:34:40 BST you wrote: > Looks like you added a ppa once for kokoto-java and that ppa no longer > exists, or at least doesn't have any packages/release information for > Ubuntu Yakkety. You can figure out what you installed from that PPA via the > Ubuntu Software Centre: > https://askubuntu.com/questions/5976/how-can-i-list-all-packages-ive-install > ed-from-a-particular-repository Thanks. It's obvious when you look at it properly. > If you haven't installed anything, or don't care about the software you did > install (in which case you can uninstall it to be safer), you can remove > that ppa ( https://askubuntu.com/questions/307/how-can-ppas-be-removed ) > and upgrade just fine. In fact, usually the GUI updater disables PPAs > anyway, so you'll just be doing that step yourself manually. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Kubuntu 16.10 -> 17.04 Update/Upgrade Issue
On Wednesday, 19 April 2017 10:16:02 BST you wrote: > Hi, > > My copy of Kubuntu 16.10 (and earlier versions) has always had an issue with > the graphical update tool (it never notices that there are any). This is a > known bug which the Kubuntu team seem unable to fix (they did once then > changed the updater and broke it again). > > As a result of this, I have been in the habit of running the 'sudo apt-get > update' / 'sudo apt- get distro-upgrade' combo on a routine basis. Since > 17.04 was released I get the following at the end of the apt-get update > stage of the process: > > Reading package lists... Done > > I've searched the Kubuntu Forums and found nothing. Has anyone else seen > this? What does it mean? > > I'm loathe to go for a full upgrade while I'm getting this message. H. What happened to the messages. Second try. Reading package lists... Done W: The repository 'http://ppa.launchpad.net/kokoto-java/omgubuntu-stuff/ubuntu yakkety Release' does not have a Release file. N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use. N: See apt-secure(8) manpage for repository creation and user configuration details. E: Failed to fetch http://ppa.launchpad.net/kokoto-java/omgubuntu-stuff/ ubuntu/dists/yakkety/main/binary-amd64/Packages 404 Not Found E: Some index files failed to download. They have been ignored, or old ones used instead. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Kubuntu 16.10 -> 17.04 Update/Upgrade Issue
Hi, My copy of Kubuntu 16.10 (and earlier versions) has always had an issue with the graphical update tool (it never notices that there are any). This is a known bug which the Kubuntu team seem unable to fix (they did once then changed the updater and broke it again). As a result of this, I have been in the habit of running the 'sudo apt-get update' / 'sudo apt- get distro-upgrade' combo on a routine basis. Since 17.04 was released I get the following at the end of the apt-get update stage of the process: Reading package lists... Done I've searched the Kubuntu Forums and found nothing. Has anyone else seen this? What does it mean? I'm loathe to go for a full upgrade while I'm getting this message. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Tuesday, 11 April 2017 13:23:36 BST Patrick Wigmore wrote: > On Tuesday, 11 April 2017, at 12:16:44 BST, Terry Coles wrote: > > Thanks. Now I can focus on the overheating. We were trying to > > avoid any holes in the case for ventilation. > > I don't want to jinx it, but you might find you have to drill > some drainage holes anyway. Water is a sly opponent! I'd keep an > eye on that. You may be right, but we'll only be running during the summer months, when the outside air temp is reasonably high. > If it's a totally sealed box, I would be inclined to at least put > some dessicant in there to absorb the moisture that's trapped in > the air inside, otherwise you might get condensation issues from > the outside temperature fluctuations. It is pretty much sealed. > > It looks like I need to put a fan inside to help natural > > convection to shift the air from the Pi to the heatsink. > > Is there a heatsink on the Pi's CPU? If there isn't, that would > be fairly easy to add and would probably go a long way, if it is > a thermal issue. Full complement of heatsinks on all three chips. CPU temp is normal. -- Terry -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Tuesday, 11 April 2017 13:00:29 BST Ralph Corderoy wrote: > Do you know what's generating the heat? Infra-red thermometer or > camera? Can anything be added that would conduct the heat from those to > the case or the internal heatsink? At this stage, I'm not completely certain that heat is the problem. I'm going in to the WMT in a few minutes, so I'll be interested to learn if the problem has been as bad since we've had this cold wind. Also, I intend to run the system out of the case for a few days, to see if we still have an issue. (That would also eliminate (or rather show up) my other theory; interference from the lighting. However, I'm not sure how interference would manifest itself only after the system has been running for some time.) As for an Infra-red thermometer or camera; no, we don't have one. It's a good idea though. Perhaps I should invest in a Pi NoIR (http://www.raspberrypi-spy.co.uk/2013/10/pi-noir-infrared-camera-module-for-raspberry-pi/) to allow me to do the tests :-) -- Terry -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Tuesday, 11 April 2017 11:40:05 BST Ralph Corderoy wrote: > They take buffers and cache out of the equation. 785612 / 16204 = 48 so > you can withstand growth at that rate for quite a few multiples of your > monitoring period, if it's linear. Thanks. Now I can focus on the overheating. We were trying to avoid any holes in the case for ventilation, so cooling depends on internal circulation of the air to move the heat from the hot-spots to a finned heatsink on the inside of the case. The case BTW is an old 7.62 mm Ammo Box :-) The idea is that the heatsink transfers heat from the air to the metal wall of the case. It looks like it may not be working as planned. It looks like I need to put a fan inside to help natural convection to shift the air from the Pi to the heatsink. If that doesn't work, I'll have to put in some vents, but that will let damp air in -- Terry -- Next meeting: Bournemouth, Tuesday, 2017-05-02 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Monday, 3 April 2017 22:37:01 BST Ralph Corderoy wrote: > > Would this be a standard subprocess.call() invocation or is there a > > better way? > > The former seems fine AFAICS. Thanks. > > Would I need to create two global instances of /dev/null if I use it > > twice in the same function? > > No, the file descriptor of the open Python File for /dev/null that you > have it dup(2)'d into the desired position, e.g. 2 if you're specifying > it's for stderr. Thanks again. > > How would the instances of /dev/null show up? > > Clearly. > So I don't expect you have to do anything to close it. It's your choice > if you opening it once per program or once per function. (I'd still go > for the former, but you've delivered the code. :-) Thanks. There doesn't seem to be much in the way of memory leaks either; I set the program running yesterday evening with dstat in another screen. When launched, I had 794 MB free, this morning it is still over 700 MB. Since it goes against the grain to routinely reboot a perfectly good system every day, I think I'll leave it as it is for the moment and tell the staff to keep an eye on it for the next few weeks. If they notice any problems, then all they will have to do is power cycle it. If it does become a problem, I'll look again at adding the reboot routine; maybe not every night, but once a week. (I once had a router that did that.) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Monday, 3 April 2017 16:39:48 BST Ralph Corderoy wrote: > > I suppose that I could set up another apscheduler event to do a reboot > > at midnight. > > If they don't need to normally twiddle switches after it powers on to > have it carry out the typically desired routines, then yes you could. Would this be a standard subprocess.call() invocation or is there a better way? > > Should I be closing it? If so, how? > > I don't remember the code precisely, but I did suggest not opening > /dev/null each time the function was called, but instead having a global > and only opening it the once. open() gives a File object and they have > a close() method. > > >>> f = open('/dev/null') > >>> f > > > > >>> f.close() > >>> f > > Ahh! That's another suggestion that got forgotten along the way. Would I need to create two global instances of /dev/null if I use it twice in the same function? > Did you set `pid` to the process ID of interest? Or replace `$pid' with > that number? :-) No. I totally misunderstood the meaning of $pid. > $ python2 -c 'import time; f = open("/etc/passwd"); time.sleep(42)' & > [1] 18933 > $ ls -l /proc/18933/fd > total 0 > lrwx-- 1 ralph ralph 64 Apr 3 16:36 0 -> /dev/pts/2 > lrwx-- 1 ralph ralph 64 Apr 3 16:36 1 -> /dev/pts/2 > lrwx-- 1 ralph ralph 64 Apr 3 16:36 2 -> /dev/pts/2 > lr-x-- 1 ralph ralph 64 Apr 3 16:36 3 -> /etc/passwd > $ How would the instances of /dev/null show up? I have the same references to / dev/pts/2 plus: 1. All of the GPIO pins appear to be there. 2. /dev/urandom. 3. /dev/gpiomem. 4. anon_inode:[eventpoll11] That's it. Does that mean that my instances of /dev/null are killed when the function exits? (I reset the clock to ensure that the functions that use that feature would be run. (They are prevented from running outside Opening Hours)). Each function has been run, but of course they exit almost immediately because everything is done with subprocess.Popen(). -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Monday, 3 April 2017 13:44:17 BST Ralph Corderoy wrote: > I was thinking this Pi was being turned off each night, like the other > one. I expect I've forgotten that it's always on. We could tell them to turn it off; they used to have to do that for the old MP3 Player (a portable stereo CD/MP3 Player that sat around on the floor of the chancel). I'd rather it is left on continuously, but it won't be the end of the world if it has to be rebooted now and then. > If the switches were set into position rather than spring-return to the > centre then one option would be to configure Raspbian to reboot > periodically, with your software picking up the settings from the switch > positions. True. Unfortunately they're not so there isn't anything we can do. I suppose that I could set up another apscheduler event to do a reboot at midnight. > It's headless, with no network, a read-only filesystem, and its outputs > are LEDs and speakers? Unless you're planning to blink or chirp status > reports there's not a lot of options for monitoring. :-) Not easily no.. > Can a cable attached to the Pi's serial port be left accessible so you > can come along with a laptop and USB/serial converter and connect up? > You'd then have access to the serial console that you'd configured it > with. We can connect a monitor and keyboard fairly easily, by opening the lid. > > That's a bit of a non-flyer too, because dstat doesn't appear to be > > available in the Raspbian repositories. > > I don't have Raspbian here, but > http://archive.raspbian.org/raspbian/pool/main/d/dstat/ suggests it is > available. Just realised why I couldn't get it. I borrowed my wife's Pi 3 and forgot to let it through the router. The Pi's WiFi icon, only tells you that you are connected to a strong wireless signal, not that you have a path to the Internet. > Yes, http://archive.raspbian.org/raspbian/pool/main/s/screen/ would do Ditto above. > I doubt leaks would be sufficient to consume all that spare memory. > More likely you'd run out of file descriptors or some other resource > first, e.g. opening /dev/null each time you play a tune and never Should I be closing it? If so, how? > closing it. `ls -l /proc/$pid/fd' would show what file descriptors > process $pid has open at that moment. I can't make that do anything: terry@OptiPlex:~$ ls -l /proc/$pid/fd Whatever, I'm going to run the program again overnight tonight using screen and dstat and see what I get. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Sunday, 2 April 2017 15:49:54 BST Terry Coles wrote: > That's a bit of a non-flyer too, because dstat doesn't appear to be > available in the Raspbian repositories. Also, the software is running in > the shell at boot up, so it would be difficult to view two things running. > (Would screen do it, I've only ever played around with it?) No 'screen on the Pi either ;-( -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Sunday, 2 April 2017 14:13:02 BST Terry Coles wrote: > > You could leave your program running in tandem with `dstat -cdngym > > $((60*30))' that produces a line every half an hour and see if anything > > obviously degrades over time. > > That wouldn't be very convenient to view, since the program is running > headless and without any network interfaces enabled. > > I'll try it here at home with a copy of the program, but I probably won't be > able to leave it running for all that long. That's a bit of a non-flyer too, because dstat doesn't appear to be available in the Raspbian repositories. Also, the software is running in the shell at boot up, so it would be difficult to view two things running. (Would screen do it, I've only ever played around with it?) Anyway 'free' works and tells me that I have just under 950MB of physical RAM to play with and immediately after boot-up about 125MB is used (well over double that in the desktop). I'm going to leave the Pi running overnight (with the speakers turned off :-) ) and run free again this time tomorrow. Assuming the memory leaks aren't horrendous, I can probably work out a maintenance schedule for the staff to restart the system once a week or whatever. As it happens the system has been running continuously since Thursday afternoon and no-one has phoned me up yet.. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
On Sunday, 2 April 2017 14:05:42 BST Ralph Corderoy wrote: > AIUI your program is doing this, with a few more bells and whistles. Lots of bells, but no whistles. > All these bits of code may have bugs where they leak memory in > processing that endless stream and over time that leak will add up and > memory will be exhausted. Or, they might not have bugs because this is > a well trodden, debugged, path. Or it might be that it would take a > week to be a problem because the leak is small and slow and your program > never runs more than a day. > > You could leave your program running in tandem with `dstat -cdngym > $((60*30))' that produces a line every half an hour and see if anything > obviously degrades over time. That wouldn't be very convenient to view, since the program is running headless and without any network interfaces enabled. I'll try it here at home with a copy of the program, but I probably won't be able to leave it running for all that long. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Can my system run out of memory if my program continuously O/Ps messages to the shell?
Hi, The question is in the Subject. My Model Town program is designed to run continuously, but I'm not sure if it will run out of memory eventually if the script continuously sends messages to the shell. I vaguely recall that there is a buffer for the content of STDOUT, but can't find any references to this on the web. (I suppose the fact that no-one seems to have problems with this is a pointer to a non-problem.) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Next Meeting - One Week Tonight
Hi, The next meeting is just one week away at the Broadway, Bournemouth on Tuesday evening at 20:00; 2017-04-04. See: http://dorset.lug.org.uk/wiki/doku.php?id=meetings:pub#the_broadway Paul, Are you going? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Wimborne Model Town - Bells Software
Afternoon All, Well. It's in and working! There's one small thing to fix; the volume of the sound from the Bell Tower is somewhat reduced by the time it gets up the 3 m of multicore cable, but it is working. I'll tweak the volume settings tomorrow. In the meantime, we've left it running overnight to see what happens. The webserver is also working and tomorrow we will finish mounting the antenna on a pole to get the coverage. Thanks to everyone who helped and a special mention for Ralph who probably did more work than I did, in trying to show me the error of my ways :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Fwd: My Python Script Only Idles in IDLE
On Monday, 27 March 2017 12:02:04 BST Peter Washington wrote: > And the Ctrl-C can be documented in the Script just like the example from > the URL :- > > Link to Auto Run Script page > <http://www.raspberrypi-spy.co.uk/2015/02/how-to-autorun-a-python-script-on-> > raspberry-pi-boot/> something > like this :- > > print("**") > print("Use Ctrl-C to stop the Wimborne Town Model") > print("**") Yes. We could, but the script prints out a lot of realtime messages regarding the time, the number of chimes that are to be struck for the Quarter Jack and the Chimes, plus the messages that you've seen to flag up the different functions starting and stopping. That message would soon scroll off the top. However, I will be providing a User Manual, so the information will go in there. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Monday, 27 March 2017 00:10:06 BST Ralph Corderoy wrote: > > No I don't think I tried it because I asked for a clarification and > > I'm not sure you answered. > > I did, but there were a lot of emails. > https://www.mail-archive.com/dorset@mailman.lug.org.uk/msg07415.html It's a fair cop. I think I did try it, but then got distracted by debouncing circuits, etc and forgot to respond. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] My Python Script Only Idles in IDLE
On Sunday, 26 March 2017 13:54:10 BST Terry Coles wrote: > Which worked, so I haven't bothered to grab the shell output when it doesn't > work. One final question; related but not really part of this thread. I've chosen to auto run the script using this technique: http://www.raspberrypi-spy.co.uk/2015/02/how-to-autorun-a-python-script-on-raspberry-pi-boot/ (This is pretty much what I did for the Lighting Project.) On boot up, everything seems to work OK and the boot shell is tied up executing the script. Would you suggest that I run this script as a background task, so that future Maintainers can get straight into the desktop by running 'startx'? Or do people think that it's better to leave it as it is, so that future Maintainers can kill the script by typing Ctrl-C? I can't remember quite what I did on the lighting software, but no-one's had to look at it since it started running last March, so it's been irrelevant so far. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] My Python Script Only Idles in IDLE
Hi, Just when you thought it was safe to put your head above the parapet, some other damn thing come along! Some time ago, there was a discussion about getting a Python Script to run from the shell. Some of my errors were identified, but I never got my main program to work that way at the time and used Ralph's test-callback.py. I have now found another reason why my script didn't do what it was supposed to do, but not the cause. My script now works perfectly in IDLE. The apscheduler and RPi.GPIO statements are all setup on startup and then the script sits there doing nothing until the user triggers an event or the time to ring the bells comes round. Afterwards the script idles until the next event. Very gratifying. The problem comes when I try to launch it from the shell on boot-up (or by direct invocation). The script runs OK, but it looks as though it then exits instead of idling as it does in IDLE (excuse the pun). Is this expected behaviour? If so, is there a way round it? Do I need to run an endless loop to keep the script alive? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Access to USB Stick under /media in Raspbian
On Sunday, 26 March 2017 11:47:39 BST Ralph Corderoy wrote: > Can you paste you running it and the result. Also, `ls -l > your-script-file'. Well. I've moved on now. and have worked out what the problem is. > To list the contents of a directory you need read permission, since the > directory is logically a list of filenames and their inode numbers; > what `ls -i' shows. To access a directory entry by name you need > execute permission on the directory. It follows if you lacked read > permission to foo but had execute permission then I could tell you that > foo/fxlshsoqvlc was the command to run, but you wouldn't be able to see > what other items were in foo other than exhaustively trying them. It turns out that Raspbian does not actually mount the USB Stick until the desktop is running (presumably the package that does it is run then). The directory which will ultimately contain the contents of the stick remains in the /media/pi directory, but there is nothing there. I have now mounted the stick in the pi directory and my code is working again. All I need to do now is get it to launch on bootup and make the filesystem read-only. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Access to USB Stick under /media in Raspbian
Hi, I'm now setting up the bells software to run headless. The music and chimes are all held on a removable USB stick plugged into one of the Pi's USB ports. When I boot into Raspbian Pixel (the desktop), this drive appears at /media/pi/MEDIA where MEDIA is the label of the USB Stick. If I execute my python code from within the desktop, eg using IDLE, everything works OK. When I launch the script from a shell, I get 'permission denied'. On investigation, it looks like it's the MEDIA directory that is denied to me. If I type: cd /media/pi/MEDIA I get the permission denied message, even if I prefix the command with sudo. If I type: cd /media/pi I can enter the directory and list it's contents. I'm assuming this is an idiosyncrasy of Raspbian (or Debian that it's derived from). I'm fairly sure that I can get this to work by adding the USB stick to fstab and mounting it somewhere in the pi user's home directory, but before I do that, I'd like to know what's going on. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Monday, 20 March 2017 17:36:39 GMT Ralph Corderoy wrote: > > If libraries are getting in the way > > It is. A Python library, de facto standard for GPIO on the Pi, shipped > with the Raspberian distro, is pretty hopeless in this area. When it > returns to asking the kernel for GPIO changes, it turns that into > calling the user-supplied Python function. Asking the kernel may be a > long time after the change occurred, so one can't debounce in software > in the callback function, and it doesn't supply the new state, so one > assumes (hopes) the value alternates between 0 and 1. > > The library has optional debounce logic; it discards all changes it > learns of within N ms of the one that triggered the callback, regardless > of whether it's a transition to 0 or 1. This means when the callback is > called again, it can't assume the switch is the opposite state to last > time depending on the parity of "debounce" transitions. Reading the > switch state in the callback is a race because it may be different to > what triggered the callback, and that change is still in the pipeline to > trigger the callback again upon return. Well. I have some good news and some bad news. The good news is that my GPIO I/Ps are now beautifully clean, with soft edges. See: http://www.hadrian-way.co.uk/Misc/scope.GIF The bad news is that it has made no difference to the behaviour of the software whatsoever ;-( I took out the bouncetime argument completely and the moment I clicked the switch I got several 'hits'. If I held the switch down, the hits just kept coming. I also got the hit on release of the switch. I put the bouncetime argument back and got it back to the way it was, eg, the occasional double hit, but generally OK. So in desperation, I increased the bouncetime to 3000 (ms) and double hits virtually disappeared. However, when I uncommented the announcements code it was just like it was before I did the alternative debounce circuit. However, if you look at the scope trace above, you will see that there is no bounce at all, so although the library seems to be reacting repeatedly when the switch is activated and when it is released, at least there should be no crosstalk. I've certainly not seen any. Presumably the way that it deals with thresholds is suceptible to noise and since, of necessity, we have to have lots of wires in our system, it's picking up noise, especially when the signal is high. It is now exactly 7 days to opening for the Model Town, so I am going back to Plan B, which is to ditch the announcements. I've already warned the Manager that this might occur and he is comfortable that the staff should be able to live with it. Annoying though. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Monday, 20 March 2017 14:13:43 GMT t...@ls83.eclipse.co.uk wrote: > I've come into this a bit late I know, but get the impression things are > getting rather involved to read some switches, although I may have got > the wrong end of the stick. It didn't start out that way ;-( > You don't need hysteresis to read input switches. You just need a pullup > resistor and the switch to ground, or a pulldown and switch to Vcc. I > prefer the former, as I don't like Vcc wandering around. In the old days > of TTL it had to be pullups but that was long ago. Typical CMOS > thresholds will be close to mid-rail, but it doesn't really matter. Yes. That's what I had originally. > Simplest way to debounce is scan keys every 100ms or so and on every 1 > to 0 transition log a keypress. Typical bounce will be much less than 100ms. These are physical switches connected to the GPIO pins, not keys (the Pi will be running headless). I was getting around 1 - 2 ms of bounce after I put 0.1 uF capacitors across the switches (but my scope is a £10 Arduino to USB device, so the bandwidth may not be good enough to see what is really happening). > You can get more involved than this if you need auto-repeat, and repeat > times are comparable to bounce times, but assuming that's not needed > here, we can forget about all that. The new circuit should provide almost symmetrical roll-off of the edges of the signals when the switches are depressed and released. any bounces will be long gone, but more to the point, the cross-talk should be significantly lower and hopefully insufficient to pass the pin threshold voltage. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Monday, 20 March 2017 14:14:35 GMT Ralph Corderoy wrote: > > > So bounces can reach that simple callback that printed the current > > > time in your cut-down Python test program? > > > > Hopefully, once by debouncing circuit is complete, there'll be no > > bounces that are worth worrying about. > > If you never tried it, just say. It would stop me asking. :-) What I was trying to say was that the bounces that I observed (with the capacitors across the switches) were only a few ms, so the new circuit should deal with them. When we were testing the switches, it was the rising edge on the switch opening bounce that seemed to be triggering the double-hit, not the switch being closed. That would be well after the Library debounce value of 300 ms has elapsed, so the next rising edge would always cause a hit (whether it is aided and abetted by the software or not). > > March 19th was last year. It's 1st April this year. > > Perhaps you or Clive can have some success in getting it fixed then. The Home page has it right, it's just on the Visitor Information Page that it is wrong. The Manager has been told (verbally) and he says that he will fix it. > > As far as I know the Pi deals with DST anyway, but I'm unsure if that > > applies when an external Real Time Clock is in use. I don't see why > > it shouldn't. > > I expect the RTC will be UTC. Linux works on that too. Layers of > software above handle UTC and localtime. Here, I pretend to be in Paris > so there's a winter difference to show. I'll check before I deploy. I don't remember having to do anything to apscheduler to get the time right when I first used it back in August/Sept, so I suspect that it just 'deals with it'. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Monday, 20 March 2017 13:17:55 GMT Ralph Corderoy wrote: > So bounces can reach that simple callback that printed the current time > in your cut-down Python test program? Hopefully, once by debouncing circuit is complete, there'll be no bounces that are worth worrying about. Something else occurred to me regarding the Schmidt Trigger inputs. I've used these device in the past and, as Peter mentions, they sharpen the edges and ensure more consistent cross-over times as the signal traverses the threshold. In this case, I don't care if the GPIO I/P detects the rising edge after 1 us or 100 ms; the user is unlikely to notice the extra delay :-) What I do care about is those super-sharp edges. I recall that when I worked on an early digital test system in the eighties, the maximum speed that the pulses could be clocked out was 100 MHz. The edges were 'fairly rounded' but certainly reached the max well before the 10 ns pulse started to go down again. We were having mega cross-talk problems until we did the sums and realised that those sharp edges contained harmonics up to 1.2 GHz! The wires in our interface hardware were acting as excellent aerials ;-( Funnily enough the clock speed of the Pi is around 1 Ghz > Wimborne Model Town is open between 1 April and March 19th and 29 > October daily March 19th was last year. It's 1st April this year. > Assuming `29 October' is correct, DST will end in the early hours on > that day. ;-) Of course. We designed it that way :-) If there is anyone still braving the elements by then, I doubt that they will worry too much if the clock is an hour out. As far as I know the Pi deals with DST anyway, but I'm unsure if that applies when an external Real Time Clock is in use. I don't see why it shouldn't. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Fwd: Python Function Appears to be Entered Twice
On Sunday, 19 March 2017 13:14:33 GMT Peter Washington wrote: > The 74HC14; 74HCT14 is a hex inverter with Schmitt-trigger inputs. This > device features reduced input threshold levels to allow interfacing to TTL > logic levels. Inputs also include clamp diodes, this enables the use of > current limiting resistors to interface inputs to voltages in excess of > VCC. Schmitt trigger inputs transform slowly changing input signals into > sharply defined jitter-free output signals. In fact that is the exact opposite of what I need ;-) What we currently have is very sharp edges (with bounce) generated by the switch, which has a pretty fast action. What this means is that the signal generates cross-talk as well as bounce and this is why I originally put in the simple solution - capacitors directly across the switch. After the discussion o this thread I now realise that the capacitors only reduced the bounce and crosstalk, not removed it and the debounce argument in the Library wasn't helping as Ralph pointed out. > I would stick to your Pull Down solution for this project, but move the > series resistor to between the capacitor and the GPIO pin to guarantee > protection for the RPi, and I'd also swap the two Resistor Values, just so > that if you ever want to add the diodes, (which you can probably also get > in an 8 pin package), it makes it easier. Which is what I've done. > I hope this is now thoroughly sorted out and that Terry can now get on with > designing his new resistor board, (with or without the diode, *if not just > ask* !! Unfortunately the original resistor networks that I obtained were the wrong way round - 47 k to deck and 4.7 k in series with the GPIO pin. There are no SIL 47 k resistor networks available and I'd already laid out and cut the tracks on the veroboard, so I've had to get 100 k isolated resistors that will fit in the positions designated. I'm hoping they'll arrive tomorrow or Wednesday. This will double the rise and fall times from 25 ms to 50 ms, but I can only see that helping. Otherwise the software is working fine; I had it running all day in my workroom yesterday with chimes every hour and quarter, solenoids clacking every quarter, change rings ringing and organ music going full tilt. My family will be glad to see the back of it :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Thursday, 16 March 2017 12:02:20 GMT Peter Washington wrote: > As i said before, (in my '*secret*' email), if there are any questions, > just ask ! Peter, I just replied to your 'secret' email, with an attachment, so I couldn't have sent it to the list anyway. For the benefit of the list, the attachment shows a solution that uses positive logic and pull-downs instead of pull-ups (because the current design is wired that way). It doesn't include the diodes, yet. I'm happy for you to respond to the list. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Thursday, 16 March 2017 09:41:41 GMT Ralph Corderoy wrote: > As distinct from them being the "0" that you were expecting to be > filtered out because you asked for "rising" edges? Yes. Exactly. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Thursday, 16 March 2017 09:17:43 GMT Ralph Corderoy wrote: > Good. I don't understand the electronic side enough to judge if the > capacitor circuit he gives is sufficient for this purpose. Give me > bits! :-) Looking at what I've got and what the RC circuit should really be, I'm coming to the conclusion that my circuit debounces the switch when it is released and not when it is depressed. However, that doesn't quite stack up with the behaviour I've seen. I'm still analysing that. > > I was trying to avoid that and my single cap and pull-down resistors > > technique seemed to work until this cropped up. > The GPIO's software debounce logic is poor and removing the bouncetime > argument gets it out the way. It seems there could be finer grade > debouncing already happening lower down the software/hardware stack and > that may be sufficient. If no bounce ever reaches the Python then the > GPIO library can just call your handler on both 1 and 0 and you can keep > a tally of which it must be and only act on the 1s. Ensuring no bounce > makes it through might already be happening without you modifying your > existing circuit. Perhaps now you know why ganssle.com suggest the > change you can try and recreate that circumstance? I think there is some bounce because when I increased the value of bouncetime it pretty much disappeared (until this). I've just got in from running errands, so I'll report back when I have a bit more of an understanding of what is going on. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Wednesday, 15 March 2017 14:28:57 GMT Ralph Corderoy wrote: > Then the space between `python' and `2.7' in the first line couldn't > have been there in the version that worked? I did spot that, but when I changed it, I hadn't made the file executable or tried your invocation with 'python2.7'. Then I made it executable, but had forgotten about the space by then > So that leaves the GPIO library and whether it has code to cope with > this and why it isn't working. I expect it's timing. Can you repeat > the test but with the time.sleep(3) commented out so the callback runs > quickly and you are unable to re-create the double-callback problem? > Meanwhile, I'll look at the library now I know what's happening above > and below it. (Might be this evening.) OK. See: http://www.hadrian-way.co.uk/Misc/strace(2017-03-15).out One thing. After I had commented out the time.sleep(3) and tried it from within IDLE. I definitely got the double-hit. I then ran your invocation of strace and pressed the switch and released it fairly quickly; only one hit. I then repeated it but held the switch down for a bit longer; two hits. This was repeatable. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Tuesday, 14 March 2017 18:38:37 GMT Ralph Corderoy wrote: > OK, though I think it's a software problem. Out of interest, what kind > of cabling and runs are we talking? It is plain wire and it was about 40 cm from the switches to the pull-downs board (via a D-Type). Then there is about 4 to 5 cm between the resistors and the GPIO pins. The capacitors (0,1 uF) are connected across each switch contact. > > pi@raspberrypi:~/WMT/Code/Minster_Functions $ sudo strace -tt -o > > strace.out -f \> > > > -e trace=process -e trace=file -e trace=desc \ > > > > > > changerings3.py > > > > strace: Can't stat 'changerings3.py': No such file or directory > > File changerings3.py isn't in the current directory. But it was. The path in the prompt matches the one below that was found, but wouldn't execute. Also, I used tab completion to confirm that I'd got the right filename. > Success! It found the file, but it isn't executable. Why? I didn't do anything special to your example and that did execute, so why won't mine? However, after I made my file executable strace worked. So I say again, how come yours worked when I didn't make it executable? !! (I've never made any of my Python files executable because I usually launch them from within IDLE or by executing: python myfile.py (This may well have changed by the time I get round to deploying this software to launch at boot-up.) > I think even if changerings3.py was made executable, it would still have > problems because it's running env(1) with `python 2.7' as arguments, and > that would run python(1), which might be version 2 or 3, and pass it > `2.7 /home/terry/WMT/Code/Minster_Functions/changerings3.py'. It > wouldn't like 2.7 as the script to run. No. It did work. > sudo strace -tt -o strace.out -f \ > -e trace=process -e trace=file -e trace=desc \ > python2.7 test-callback.py See http://www.hadrian-way.co.uk/Misc/strace.out -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Tuesday, 14 March 2017 17:21:12 GMT Stephen Wolff wrote: > >> What's the line look like that registers your callback? > > > > I've put the complete script, cut-down as you suggested, in: > > http://www.hadrian-way.co.uk/Misc/changerings3.py.txt > > > >> Taking the stripped down, simple as possible, test program, have it do > >> the time.sleep(2) and not import the subprocess module. Run it under > >> strace(1) to capture its interactions with the kernel. (The Python > >> module is a poorly documented black box there to provide a "helpful" > >> abstraction; we're now trying to see through it to understand its > >> behaviour. :-) > >> > >> sudo strace -tt -o strace.out -f \ > >> > >> -e trace=process -e trace=file -e trace=desc \ > >> your-python-script.py > > Can you put the ‘add_switch_events()’ under an if __name__ == ‘main’: > > see > > - http://stackoverflow.com/questions/4041238/why-use-def-main > > could it be that the script is called each time the file is imported? So I rewrote the last line of the script as: if __name__ == '__main__': add_switch_events() but the code didn't do anything! -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
Ralph, It's been a while since you wrote. Yesterday was model town day + shopping and this morning, I had other errands to run. so I only got onto all this again this afternoon. In the meantime, Clive has shortened the cabling considerably and we've removed the outer plastic sheath and teased out the wires on all of the cable runs to reduce the cross-talk to a minimum. I monitored the 'Change Runs On' GPIO pin with my (fairly limited) Arduino based scope and saw a little bounce when the switch was depressed (less than 1 ms) and no bounce when it was released (as you would expect). Of course, a very fast edge or ringing wouldn't show up on that scope, although I have been offered the loan of a real one, if it would help. On Sunday, 12 March 2017 18:10:45 GMT Ralph Corderoy wrote: > What version is the GPIO Python module you're using? If it's not > obvious, then there may be a GPIO.VERSION string that can be printed > from Python. pi@raspberrypi:~ $ find /usr/ | grep -i RPi.GPIO /usr/share/doc/python-rpi.gpio /usr/lib/python3/dist-packages/RPi.GPIO-0.6.3.egg-info This ties in with the version in the Raspbian Package Manager. > What's the line look like that registers your callback? I've put the complete script, cut-down as you suggested, in: http://www.hadrian-way.co.uk/Misc/changerings3.py.txt > Taking the stripped down, simple as possible, test program, have it do > the time.sleep(2) and not import the subprocess module. Run it under > strace(1) to capture its interactions with the kernel. (The Python > module is a poorly documented black box there to provide a "helpful" > abstraction; we're now trying to see through it to understand its > behaviour. :-) > > sudo strace -tt -o strace.out -f \ > -e trace=process -e trace=file -e trace=desc \ > your-python-script.py I couldn't get that to work. See what I tried: pi@raspberrypi:~/WMT/Code/Minster_Functions $ sudo strace -tt -o strace.out - f \> -e trace=process -e trace=file -e trace=desc \ > changerings3.py strace: Can't stat 'changerings3.py': No such file or directory pi@raspberrypi:~/WMT/Code/Minster_Functions $ sudo strace -tt -o strace.out -f -e trace=process -e trace=file -e trace=desc changerings3.py strace: Can't stat 'changerings3.py': No such file or directory pi@raspberrypi:~/WMT/Code/Minster_Functions $ sudo strace -tt -o strace.out -f -e trace=process -e trace=file -e trace=desc ~/WMT/Code/Minster_Functions/ changerings3.py strace: exec: Permission denied pi@raspberrypi:~/WMT/Code/Minster_Functions $ sudo strace -tt -o strace.out -f \ > -e trace=process -e trace=file -e trace=desc \changerings3.py strace: Can't stat 'changerings3.py': No such file or directory I'm not sure why it can't find the script; I used tab completion to get the name right. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Thursday, 9 March 2017 23:16:15 GMT Ralph Corderoy wrote: > What > https://docs.python.org/2.7/reference/simple_stmts.html#the-global-statement > is saying is that you only need to point out global variables with `global' > when you want to write to them, not just read them. And using `global' is > an indication to the reader that you intend to write, so it isn't used just > to point out a variable is global as that misleads. (The reader can > probably recognise a global that's only being read due to its longer name.) OK. Thanks. I picked up the idea from a bit of code that I saw, but didn't realise the distinction. > I echo Patrick's question; that seems inconsistent with there only > being one line printed in the other email. > > > > Are the callbacks defined to be edge triggered, so on the switch's > > > transition from off to on? Yes. the ARG is GPIO.RISING. I don't believe that the Library supports level triggering and I wouldn't want that anyway. > You didn't mention whether the Python library says what triggers the > callback. Have you tried moving the switch from off to on and holding > it there against the spring and observe what happens? Does the callback > run once with one line printed? Once it's all finished, let the switch > spring back to off; does it call the callback again? Se my response to Patrick. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Function Appears to be Entered Twice
On Thursday, 9 March 2017 20:40:48 GMT Patrick Wigmore wrote: > In your first email, you said that there was only one 'Message > Played' text output when time.sleep() is commented. I did and this is true, although I was probably less than clear. I get one 'Message Played' text output when *both* the time.sleep() *and* the subprocess.call() lines are commented. I get two 'Message Played' text outputs when *either* of those two lines are uncommented. > So, does this mean that sometimes you get one 'Message Played', > but sometimes you get two with no delay between them? Does it > depend on whether the line to invoke the player is commented out? Yes. See above. > Just trying to think of possiblities: Is there any kind of > feedback loop occurring through you (the human operator), whereby > the delay influences the way in which you operate the switch? > > Does it make a difference how long you hold down the switch > before releasing it? A good point, which I hadn't pursued because it only occurs when those lines aren't commented out. I just held down the switch until the first 'Message Played' text output was printed (eg, after the 2 second delay) and then waited ten more seconds before releasing it. I then got the second 'Message Played' text output. This implies that there may be wiring issues, except that without those two lines the code behaves as expected. We did have cross-talk issues, but we've solved those by putting some small capacitors across the switches and by removing the outer insulating sheath from the cable that connects the switches to the pull-down resistors. We also had switch bounce issues originally, but that was resolved by the capacitors and the bouncetime argument in GPIO.add_event_detect() statements. The result of this test implies that the program is reacting to a GPIO.FALLING event, but there aren't any programmed. In any case, why does this event only get detected when the two lines aren't commented? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
[Dorset] Python Function Appears to be Entered Twice
Hi, It's me again. My program is all but fully working and those who were at the Meeting on Tuesday may recall me foolishly saying how I didn't have much left to do ;-( One of the few things left is playing the announcements before the Change Rings, MP3 Player, etc start. The functions all work fine until I add this code at the beginning. When I do, the triggered function seems to be executed twice. Here is a cut down version of the change_rings_start() function, which I've been using to analyse what is going on: def change_rings_2(channel): global msg_subdir, chr_subdir, c_player msg_file = 'Change_Rings_On.wav' msg_path = os.path.join(msg_subdir, msg_file) #subprocess.call(['aplay', '--device=plughw:1,0', msg_path]) #time.sleep(2) print 'Message Played' (In the full function, the mpg321 player is invoked using subprocess.Popen() to play the bells/music straight after this code. I have changed the callback so that this cut-down function is called instead when I press the switch.) As written, this code executes as expected and prints a single line 'Message Played' to the Python console. If I uncomment the time.sleep() line, then it prints two. If I uncomment the line that invokes the player, I get two lots of the 'Change_Rings_On.wav' message to the speaker. In the original change_rings_start() function, I get two announcements and the change rings start playing, twice. (The first playback is terminated by a call to change_rings_stop() just after the announcement.) (Please ignore the fact that I am now using aplay instead of mpg321. I couldn't get the message to play at all for some reason and when I did, by using aplay, two came along.) Has anyone any ideas what is going on here? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-04-04 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Saturday, 4 March 2017 13:35:39 GMT Ralph Corderoy wrote: > 'mpg321' is a string, type `str' in Python. You had a list of mpg321 > arguments. Even if you want to drop all the other arguments for the > moment, it still needs to be a list; a list of one string. The fourth > example is joining two lists. You can't concatenate a list to a string, > as that error says. I now have it working. I don't know why it didn't work before, I was concatenating a list containing 'mpg321' and the list containing my mp3 file references and getting the error about arg 2 only containing strings. I then added the -l and -m arguments to the first list and it is now working. Is a list with only one element somehow different? > A lot of time would be saved by reading about the Python basics. Not > all the standard library functions, not how to write your own object > classes, and all the odd corners of Python, but chapters 1 to 5 of > https://docs.python.org/2/tutorial/index.html to give a grounding for > reading about the specific things you need to do and how to join them > together. It doesn't have to be memorised either, just familiar enough > to recognise the syntax and know where to go back to read about it. I'm not sure that would help that much. You may recall that at the beginning of this discussion, I said that I was struggling with the documentation. I have worked through a good deal of my 'Learning Python' book, I've read quite a bit of the material you mention over the last year or so (piecemeal, not end-to-end) and I watched online video tutorials. In the end, my lack of ability in this subject comes down to several factors I suspect. The reason that I became a Systems Engineer is that it allowed me to make best use of my documentation skills, I have a good grasp of concepts and I tend to take a holistic approach to all the things that I do. What I'm not very good at is remembering the minutiae of details that you need to understand to be a programmer and I'm not all that good at logic. I also have a terrific long-term memory and a totally atrocious short-term one. Finally, I am now definitely in the old dog stage of life :-) -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Saturday, 4 March 2017 12:55:34 GMT Ralph Corderoy wrote: > Yes, stderr will be going to your TTY along with stdout if you do > nothing to change that. > You should be able to re-produce the above at Python 2's `>>> ' prompt. I was certainly getting error messages in the Python shell, but they only popped up when I tried the subprocess.Popen() statement mentioned in my last message, with an error of: TypeError: execv() arg 2 must contain only strings When I tried to play the long string of filenames mentioned earlier there were no errors. Back in the mists of time, when I tried to play ./Playlists1/*.mp3 I probably got the missing file error, but that just led onto the discussion about joining my list to my command string. > > So what kind of join did you have in mind? > > It's the fourth example in that link I gave that you went and read. :-) > https://docs.python.org/2/tutorial/introduction.html#lists That gives the error: TypeError: cannot concatenate 'str' and 'list' objects I am trying to join 'mpg321' to the list with no other parameters for the moment. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Saturday, 4 March 2017 00:27:13 GMT Ralph Corderoy wrote: > Python prints lists with commas between items, but a list isn't a string > and the commas are just formatting. You need to join your mp3_files > list onto the end of your hard-coded ['mpg321'...] one so Popen() sees > just one long list. And that's exactly what I've been trying to do all along :-) (With no success so far.) So the latest iteration of the code creates a Python list called mp3_list using your glob.glob example. I then use a bit of string concatenation in a loop to create a string called mp3_files. This contains: ./Playlist1/01_Marche_Episcopale.mp3 ./Playlist1/02_Choral-Herzlich - BWV 727.mp3 ./Playlist1/03_Choral-Herr Jesu Christ.mp3 ./ Playlist1/04_Choral_Du_Veilleur_BWV_645.mp3 eg, a list of file references separated by spaces. If I paste this into a shell after mpg321 it works. If I put it into my subrocess call as: mp3_player = subprocess.Popen(['mpg321', mp3_files]) it raises no complaint, but nothing plays. I've also tried os.path.join() with no success to create the list of files and the only method that produced something that would play in the shell was simple string concatenation. So is there another way to create my space separated list that works, or is my subprocess.Popen() wrong? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Friday, 3 March 2017 17:46:43 GMT Ralph Corderoy wrote: > Hi Terry, > > > > Change it back to that and take them to be directory names instead, > > > and `daisy/*.mp3' is what you pass to mpg321 using your existing > > > `sorted(...listdir)' functional-programming thingy. Well actually, that is one of the things that I tried before I got down and dirty and really basic. > > even if I explicitly change directory to the one containing the files > > Don't do that. No I don't want to, but I was trying things out to see if it would work with the simplest approach. > But that's not "using your existing... functional-programming thingy" > mentioned above. > > mp3_files = sorted(os.path.join(mp3_subdir, x) for x in > filter(lambda f: f.lower().endswith(".mp3"), os.listdir(mp3_subdir))) No it's not, but that bit of code produces a list of files, including paths, separated by commas (all the os methods that I tried (such as os.list dir do). Comma separated filenames don't work in the shell either. > There's also glob.glob() that would probably make the above simpler. > https://docs.python.org/2/library/glob.html > > mp3_files = sorted(glob.glob(mp3_subdir + '/*.[Mm][Pp]3')) That also puts the commas in. I've been trying to work out how to strip the commas out, but then I tried making the list manually and I couldn't get that to work either. > mpg321 sees the literal string `*.mp3' and tries to open it. If it > exists, it would play it. > A raw `*.mp3' in the source don't mean those filenames to Python as it > doesn't glob strings like a shell. That's why you're doing listdir(), > etc. Yes. I suspected as much. Presumably in the shell the * is expanded before it is given to mpg321 (without commas) so it works. > I think part of the problem here is you're trying to write a program to > meet your needs in Python, not trying to learn Python so you can then > write a program to meet your needs. :-) Learning all of Python before I set out to write the code would be a major task in itself. Then I'd probably learn the wrong bits. I have followed some tutorials online, but none of them got down to this stuff. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Friday, 3 March 2017 15:00:00 GMT Ralph Corderoy wrote: > mpg321 has a -l option to loop N times. If N is 0 then forever. So > your callback starts mpg321 with -l and gives it the sorted list of all > the MP3s in the current playlist-directory entry, e.g. > `valkyries/*.mp3'. Then it forgets all about it until it's time to > SIGTERM it. Except it doesn't (for me anyway). If I issue the command: mpg321 -l ./Playlist1/*.mp3 in a shell it works. In my Python program it doesn't, even if I explicitly change directory to the one containing the files and format my statement as: mp3_player = subprocess.Popen(['mpg321', '-q', '-m', '-a', 'hw:0,0', '*.mp3']) If I use: mp3_player = subprocess.Popen(['mpg321', '-q', '-m', '-a', 'hw:0,0', '01 Marche Episcopale.mp3']) it works. If I use: mp3_player = subprocess.Popen(['mpg321', '-q', '-m', '-a', 'hw:0,0', *.mp3]) (eg no quotes around the *.mp3), I get a syntax error on the asterisk. Can this be escaped somehow? Or is there something else that I've missed? -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Friday, 3 March 2017 14:03:27 GMT Terry Coles wrote: > On Friday, 3 March 2017 14:00:43 GMT Ralph Corderoy wrote: > > Where do you get your mpg321 program from? A package in the > > distribution? If so, which package, which distribution? Or somewhere > > else? > > On the Pi its the Raspbian repository and on this machine it's the Kubuntu > one. > > Both appear to behave the same. Sorry. The package name is simply mpg321 and the version is 0.3.2-1.1 on both. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR
Re: [Dorset] Python Multiprocessing (or Maybe Multithreading)
On Friday, 3 March 2017 14:00:43 GMT Ralph Corderoy wrote: > Where do you get your mpg321 program from? A package in the > distribution? If so, which package, which distribution? Or somewhere > else? On the Pi its the Raspbian repository and on this machine it's the Kubuntu one. Both appear to behave the same. -- Terry Coles -- Next meeting: Bournemouth, Tuesday, 2017-03-07 20:00 Meets, Mailing list, IRC, LinkedIn, ... http://dorset.lug.org.uk/ New thread: mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING Reporting bugs well: http://goo.gl/4Xue / TO THE LIST OR THE AUTHOR