my script was in error but it is shown only from terminal, not from ide. From ide this works good. In script i have code that is used for getting temperature from dht11 sensor and error was in ascii °C.
Finaly, i found the error.. in my script i have dht11 check for temp. And guess what, i have in string °C for celsius and this was the problem. But i dont know why this was problem when i comment this line of code. Like the script was retain in memory.
No i didn't say that, log shows error on line 182 but if i comment that line, error shows line 182 again, no matters i do recompile python script. May be the problem is in pyc file? Does pyc file recompiles again or may be this would be the problem? i will delete pyc and recompile again. i didn't te...
Script is same all but connection from cloud mqtt broker was change to mosquitto mqtt local raspberry pi broker on same raspberry machine as script is placed. Will try to put in sh script sudo -u pi /path/file_name as you suggest to.
oooooooo, i remember... I was starting my own local mqtt server after this was working because mqtt server was cloudmqtt then, and now it is local, may be this is problem, even with sudo or not sudo, mqtt connection from python script was connecting cloud server in my script then.
ok, is something changed within year or two with the grants because two years ago, my autostart was working and now it is not working anymore. My script was in home/pi/.config/autostart/MyPiAutostart.desktop that calls home/pi/myPiFolder/myPiScript.py with proper chmod, i dont remember what chmod wa...
With regard to using rc.local as ankith26 suggested, you don't need to add sudo to the start of your program line as rc.local is already running as root. which may be a problem if you program is expecting to be run as the pi user.
Why this may be a problem if my python script is runing as user pi?
I read somewhere that if I use mqtt or mysql in my python script, this will not work anymore but I dont know whay this is matter? i think it is desinformation on the net, because this works year ago. How can i debug what happens in desktop or in sh script that is used to call python script?
Hi all, My scripts have been working two years ago. Then I did not used it for a long and remove it from the scripts.... Now I have to go back and start using it again and surprise...not working anymore... What is the problem.... I have MyPiAutostart.sh script in folder home/pi/myPiConfig Here in sa...
class MyClass: glo_class = 11 def method(self): """ Instance methods need a class instance and can access the instance through `self`. """ print("method1: "+str(self.glo_class)) self.glo_class = 1 print("method2: "+str(self.glo_class)) print("method3: "+str(MyClass.glo_class)) return 'instance meth...
Thanx. I learn OOP in Java..
This example will help yes, any piece of examples helps me to understaind more from OOP and Python.
My example is trying to change instance of class A with getting it through constructor in instance B..
thanx for the links.
I am new in OOP and I try to learn about private and public variables, instance and class variables and found nothing but close to this that I have written. Yes, maybe i am on the wrong way, i just want to learn. I will read from those links, thanx,
Hi, I started to learn Python Class (OOP). I have example code with commented question... Can Anyone explained to me my questions in comment? I do not understaind some pieces of class variables... This is the code: #!/usr/bin/env python3 class A: def __init__(self): self.__num = 1 print("1. Init num...