Go to advanced search

by jadro
Mon Apr 08, 2019 8:46 am
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

Yes,
I have put this
#!/usr/bin/env python
# -*- coding: utf-8 -*-
but this not helped me...
by jadro
Sun Apr 07, 2019 6:46 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

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.
Jadro
by jadro
Sun Apr 07, 2019 3:39 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

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.
Jadro
by jadro
Sun Apr 07, 2019 2:51 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

i have just tested it directly from terminal and from here error is shown. Why terminal does not start py script as ide do? I just cannot find non ascii error
by jadro
Sun Apr 07, 2019 1:06 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

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...
by jadro
Sun Apr 07, 2019 8:57 am
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

hmmm, does this error may be in line 182 in myscript.py not direct in myscript, but in script what is included in myscript.py? I use dht some script included in myscript
by jadro
Sat Apr 06, 2019 10:25 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

Log helped my to see error but i dont think this is real error
Non-ASCII character '\xc2' in file
because of line error 182 that have commented in python code and error exists over and over again
by jadro
Wed Apr 03, 2019 8:08 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

Thanx for suggestions, i will try one by one
by jadro
Wed Apr 03, 2019 7:51 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

o thanx.
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.
by jadro
Wed Apr 03, 2019 7:33 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

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.
by jadro
Wed Apr 03, 2019 7:26 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

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...
by jadro
Wed Apr 03, 2019 7:05 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

epoch1970 wrote:
Wed Apr 03, 2019 5:33 pm
To be clear, if your run "python2 /home/pi/myPiConfig/myController.py" as user pi, does your script start correctly?
I try in terminal and yes, my script is runing, so, yes, it starts correctly
by jadro
Wed Apr 03, 2019 6:47 pm
Forum: Python
Topic: How to Auto-Execute Python file on Startup using Raspberry Pi 3
Replies: 24
Views: 2179

Re: How to Auto-Execute Python file on Startup using Raspberry Pi 3

pcmanbob wrote:
Tue Apr 02, 2019 9:54 am
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?
by jadro
Wed Apr 03, 2019 5:22 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

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?
by jadro
Mon Apr 01, 2019 9:28 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

Nothing helped me... my script cant load at boot, strange... i will try cron soon... i think it is last chance.. i try few methods but none of them is working..
by jadro
Wed Mar 27, 2019 7:08 am
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

hmmmm yes, rc.local... I will try it. Thanx
by jadro
Tue Mar 26, 2019 6:07 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Re: Raspbian Jessie Autostart

Nobody with same problem?
by jadro
Sat Mar 23, 2019 2:30 pm
Forum: General discussion
Topic: Raspbian Jessie Autostart
Replies: 8
Views: 436

Raspbian Jessie Autostart

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...
by jadro
Mon Feb 11, 2019 8:24 pm
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Re: Class questions

Thanx MrYsLab, great to know that my class variable is copied into instance variable with same name, I didn't know that.

Thanx,
Jadro
by jadro
Mon Feb 11, 2019 4:49 pm
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Re: Class questions

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...
by jadro
Fri Feb 08, 2019 4:17 pm
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Re: Class questions

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..
by jadro
Fri Feb 08, 2019 6:42 am
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Re: Class questions

I dont think it's luck, i think it's good practice. I rather follow a good and right direction. Thanx
by jadro
Thu Feb 07, 2019 10:38 pm
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Re: Class questions

Hi,
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,
Jadro
by jadro
Thu Feb 07, 2019 9:24 pm
Forum: Python
Topic: Class questions
Replies: 11
Views: 460

Class questions

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...
by jadro
Sun Jan 06, 2019 10:40 am
Forum: General discussion
Topic: Streaming video with MQTT
Replies: 4
Views: 1349

Re: Streaming video with MQTT

Thanx, i will send a link from mqtt to video saved to raspberry as you said.

Go to advanced search