Go to advanced search

by sanpaulus
Thu Apr 09, 2020 9:05 am
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 845

Re: Pyton script crashes after 4 hours

well, that seems to work so far... been running the script since 48h without interruption

thank you guys
by sanpaulus
Tue Apr 07, 2020 11:45 am
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 845

Re: Pyton script crashes after 4 hours

Thank you scotty101 for helping me out! The try/except is a good solution for most of the listed problems. But what i keep getting is the message: urllib.error.URLError: <urlopen error [Errno -3] Temporary failure in name resolution> That error is not listed in the Idle3-error-list... so i don't kno...
by sanpaulus
Wed Mar 25, 2020 8:40 pm
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 845

Re: Pyton script crashes after 4 hours

I'd put a try/except in to your code to skip past any invalid data and wait for the next valid response. For example while True: try: ......... f = urllib.request.urlopen(tvocURL +str(temp[0])) ..... except IndexError: pass #Skip this and try again. Change (or add more) "except IndexError"...
by sanpaulus
Wed Mar 25, 2020 8:35 pm
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 845

Re: Pyton script crashes after 4 hours

If the code formatting is as posted, then the last 3 lines are not indented within the inner while loop. As a result, the script is calling SerialIn.readline() as often as it can without pausing at all. Yes, I corrected the last 3 lines and now the script is running without any interruption( it's b...
by sanpaulus
Tue Mar 24, 2020 4:55 pm
Forum: Python
Topic: Pyton script crashes after 4 hours
Replies: 13
Views: 845

Pyton script crashes after 4 hours

Dear people, I'm working on this python script to plot the air quality from an arduino - sensor. The collected data gets uploaded on thingspeak.com, to make the data visible for mobile phones. It works good just like i want it, but: only for 3-4 hours. Than it crashes. I collected the Error-messages...
by sanpaulus
Tue Dec 10, 2019 9:51 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

Code: Select all

@reboot sleep 30 && export DISPLAY=localhost:0 && python3 /home/pi/myscript.py
Changed the sleep to 180 to make sure wifi conection is build up before the script starts.
It works now! problem SOLVED

Thank you guys so much
by sanpaulus
Tue Dec 10, 2019 9:34 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

here's what cronlog said after i tried the code from the begining: 2019-12-10 22:23:37.243580,0,400 2019-12-10 22:23:38.150592,0,400 2019-12-10 22:23:39.228499,0,400 Traceback (most recent call last): File "/usr/lib/python3.5/urllib/request.py", line 1254, in do_open h.request(req.get_meth...
by sanpaulus
Tue Dec 10, 2019 4:11 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

The log file had something in it: Traceback (most recent call last): File "/home/pi/Uhrzeit.py", line 3, in <module> window = tkinter.Tk() File "/usr/lib/python3.5/tkinter/__init__.py", line 1880, in __init__ self.tk = _tkinter.create(screenName, baseName, className, interactive,...
by sanpaulus
Mon Dec 09, 2019 9:21 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

ps aux | grep myscript.py tried that to check if the script is running. once while the script is running, and to compare once without running my script. so yeah, the crontab -e @reboot python3 /home/pi/myscript.py is not starting my script when rebooting. also i tried @reboot python3 /home/pi/myscr...
by sanpaulus
Mon Dec 09, 2019 6:58 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

thanks you for helping me! My pi is back to normal conditions. @lxpanel --profile LXDE-pi @pcmanfm --desktop --profile LXDE-pi did the job. but the autostart-issue is still not solved. Tried to get a solution with crontab -e directly tipped in the terminal than simply scrolled down to the bottom and...
by sanpaulus
Mon Dec 09, 2019 10:22 am
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Re: Python script automatic start

thank you for the answer.

i found a tutorial describing what you just meant:
https://www.raspberrypi-spy.co.uk/2014/ ... e-desktop/

i tried to run leafpad at autostart. it worked, but my pi isn't booting up now anymore. no desktop. just a black screen.
by sanpaulus
Sat Dec 07, 2019 1:28 pm
Forum: Python
Topic: Python script automatic start
Replies: 15
Views: 1285

Python script automatic start

Hello people, i need help. I have a python script, located on an USB-stick, the path looks like: /media/pi/USBstick/Data it needs to starts automaticly AFTER the pi boots up completly. my script looks like this: #!/usr/bin/python3 import csv import time import datetime import serial import urllib.re...
by sanpaulus
Wed Nov 27, 2019 6:36 pm
Forum: Python
Topic: 'set' object does not support item assignment
Replies: 2
Views: 297

'set' object does not support item assignment

Hey people, i got this code: import thingspeak import time import serial channel_id = 907xxx # PUT CHANNEL ID HERE write_key = 'JFI2L1AX2NIKFxxx' # PUT YOUR WRITE KEY HERE read_key = 'WCCZSL1L7LP5Mxxx' # PUT YOUR READ KEY HERE SerialIn = serial.Serial("/dev/ttyUSB0",9600) def measure(chann...
by sanpaulus
Sun Nov 24, 2019 6:50 pm
Forum: Python
Topic: thingspeak upload port:'/dev/ttyUSB0' data
Replies: 2
Views: 465

Re: thingspeak upload port:'/dev/ttyUSB0' data


The user needs to decide which key should be used. The change is inline with thingspeak API design.
i think i don't get this right... does that mean i have to delete the write_key=write_key command and change the api key from read to writekey?
by sanpaulus
Sun Nov 24, 2019 4:28 pm
Forum: Python
Topic: thingspeak upload port:'/dev/ttyUSB0' data
Replies: 2
Views: 465

thingspeak upload port:'/dev/ttyUSB0' data

hey, I want to automaticaly upload data from my arduino to tingspeak, I'm trying to run this code import thingspeak import time import serial channel_id = 907535 # PUT CHANNEL ID HERE write_key = 'JFI2L1AX2NIKFXXX' # PUT YOUR WRITE KEY HERE read_key = 'WCCZSL1L7LP5MXXX' # PUT YOUR READ KEY HERE Seri...
by sanpaulus
Sun Nov 24, 2019 1:08 pm
Forum: Python
Topic: Python 3: ImportError: No module named
Replies: 2
Views: 2164

Re: Python 3: ImportError: No module named

Use pip 3 to install modules for python 3 . If you're installing things with sudo apt get ... make sure you get the python 3 -* versions of packages. Use idle 3 (or better thonny) to debug your python 3 code. Thankfully 2020 should set in motion the death of python2 (and it's annoying incompatibili...
by sanpaulus
Sun Nov 24, 2019 11:19 am
Forum: Python
Topic: Python 3: ImportError: No module named
Replies: 2
Views: 2164

Python 3: ImportError: No module named

hello, i can't install modules on python 3. all my modules only work in idle 2. i get error-messages like >>> import thingspeak Traceback (most recent call last): File "<pyshell#1>", line 1, in <module> import thingspeak ImportError: No module named 'thingspeak' what can i do?
by sanpaulus
Sat Nov 23, 2019 2:31 pm
Forum: Python
Topic: String prefix in Python
Replies: 5
Views: 560

Re: String prefix in Python

Your temp variable is a string containing two values separated by a comma. csvwriter is trying to output that as a single field, hence the quotes. You need to split temp into multiple values. Try: temp = temp.decode('utf-8').rstrip().split(',') print("{0},{1},{2}". format(time_now, temp[0...
by sanpaulus
Sat Nov 23, 2019 11:07 am
Forum: Python
Topic: String prefix in Python
Replies: 5
Views: 560

Re: String prefix in Python

rstrip() and strip() made my csv look like this: datetime,field1,field2,field3,field4 2019-11-23 11:57:48.306683,"0,400" 2019-11-23 11:57:49.345603,"0,400" 2019-11-23 11:57:50.384460,"0,400" 2019-11-23 11:57:51.423058,"0,400" so there's no new line for the clo...
by sanpaulus
Fri Nov 22, 2019 5:26 pm
Forum: Python
Topic: String prefix in Python
Replies: 5
Views: 560

Re: String prefix in Python

so i found out that i need to ad a .decode("utf-8") to the write and print commands. like this: print("{0},{1}". format(time_now, temp.decode("utf-8"))) sensorwriter.writerow([time_now, temp.decode("utf-8")]) the csv written data looks better now, like this: d...
by sanpaulus
Fri Nov 22, 2019 4:41 pm
Forum: Python
Topic: String prefix in Python
Replies: 5
Views: 560

String prefix in Python

Hi. I want to upload my data to thingspeak.com here's my Code for python3.5 : import csv import time import datetime import serial SerialIn = serial.Serial("/dev/ttyUSB0",9600) with open("sensor.csv", "w") as csvfile: sensorwriter = csv.writer(csvfile) sensorwriter.writ...

Go to advanced search