[Cialug] Python failing

Patrick Mcgillan patrick.mcgillan at gmail.com
Thu Jun 30 19:34:48 CDT 2016


This problem is on hold.

Tried to load syslog-ng and got weird load errors. Tried a apt-get update
and it had problems.

Backed up my relevent files, then booted up the netinst cd for Debian.
Gonna totally reload.

Will report back in a day or so if this problem still persists.

In short, the arduino uno never stops trying to send, but the tx flash when
it sends is missing. The heartbeat on the uno continues its 1 a second
flash, so the uno is running.

Run the python program in a terminal and it randomly stops displaying data.
The process is still running, but not sure to where. LOL

Ctrl-c to stop python program, up-arrow and enter to restart. It starts
right up and goes back to showing data in the terminal screen.

Note also that the uno goes back to sending as the tx lt flickers every so
often. 4 different messages and each is apprx 1 minute apart, so each
minute, 4 messages are received by the uno and sent down the usb cable to
the server.

Couldn't find anything in any log program or journal about USB problems.


--
Patrick

On Thu, Jun 30, 2016 at 12:33 PM, Sean Flattery <sean.r.flattery at gmail.com>
wrote:

> I agree with David, it looks like an issue with input from ttyUSB0.  Like
> you, I'm no python expert but it appears that the script doesn't have code
> to handle lack of input from your serial connection.  When your While True
> statement turn to false, the program ends.  You could modify the code to
> wait, or maybe hack up a workaround like a cron job to restart the python
> code if it's no longer running.
>
> If journalctl doesn't have the logs you want, try installing and running
> syslog-ng.
>
>
>
> Date: Thu, 30 Jun 2016 07:00:46 -0500
> > From: Patrick Mcgillan <patrick.mcgillan at gmail.com>
> > To: Central Iowa Linux Users Group <cialug at cialug.org>
> > Subject: Re: [Cialug] Python failing
> > Message-ID:
> >         <CACQ_s3kSEFQgt9ZE85S2WknXKtwVQkh1QCS5mnpaLi-B=
> > OTQGA at mail.gmail.com>
> > Content-Type: text/plain; charset=UTF-8
> >
> > how interesting. there are no system logs. there is a dmesg log, but
> > nothing in it past boot of course. the version is known as bbq, picked
> for
> > its small foot print. not been worth it and am thinking of switching back
> > to regular debian.
> >
> > I wonder if there is a missing package that could be loaded to restore
> > normal runtime logs. cron works and until you asked i assumed logs were
> > working, just never went and looked.
> >
> >
> > --
> > Patrick
> >
> > On Wed, Jun 29, 2016 at 11:42 PM, David Champion <dchamp1337 at gmail.com>
> > wrote:
> >
> > > Do you see any system messages about ttyUSB0 having issues?
> > >
> > > -dc
> > >
> > > On Wed, Jun 29, 2016 at 7:44 PM, Patrick Mcgillan <
> > > patrick.mcgillan at gmail.com> wrote:
> > >
> > > > The following script has been running fine for over a year. Now it is
> > > > stopping more than once a day. Kill program and restart and it again
> > runs
> > > > fine for a while. Any thoughts? I know enough about python to be
> > > dangerous
> > > > to myself. n arduino uno is sending messages to the server running
> the
> > > > capture script.
> > > >
> > > > Patrick
> > > >
> > > >
> > > > #!/usr/bin/python
> > > >
> > > > import serial
> > > >
> > > > debug = 0
> > > >
> > > > MySerial = serial.Serial('/dev/ttyUSB0', 9600)
> > > >
> > > > while True:
> > > > data = MySerial.readline();
> > > > print "%s" % (data)
> > > >
> > > > if data.count(":") == 2: who,s1,s2 = data.split(":",3)
> > > > if data.count(":") == 3: who,s1,s2,s3 = data.split(":",4)
> > > > if data.count(":") == 4: who,s1,s2,s3,s4 = data.split(":",5)
> > > > if data.count(":") == 5: who,s1,s2,s3,s4,s5 = data.split(":",6)
> > > > if data.count(":") == 6: who,s1,s2,s3,s4,s5,s6 = data.split(":",7)
> > > >
> > > > if data.count(":") > 1:
> > > > fileout = open ('/var/local/Sensor/' + who + '-Data.txt', 'a');
> > > > fileout.write (data);
> > > > fileout.close();
> > > > if data.count(":") > 1:
> > > > fileout = open ('/var/local/Sensor/' + who + '-Last.txt', 'w');
> > > > fileout.write (data);
> > > > fileout.close();
> > > > _______________________________________________
> >
> >
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>


More information about the Cialug mailing list