What server and language do you use for Raspberry PI

be80be

Joined Jul 5, 2008
2,395
I missed with it a bit last night.
The pi is using newer python.
It probably be easier to write it over my self.
 

be80be

Joined Jul 5, 2008
2,395
Ok I played with this a bit and it works if you run this file as is no changes and open there page and click on the on and off buttons it will.
But befor you try let's go over some stuff
First off python uses indentation to tell where the if then ends while loop ends you mess with the indentation the file will error and not run so this is what I do
I use linux and Scite I think it will work on windows what Scite does is it let you test your code
You set it for python and test for indentation and if it's ok you can try it out
To run this you save as say test.py
Code:
import RPi.GPIO as GPIO
import urllib2
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.setup(26,GPIO.OUT)
true = 1
while(true):
                try:
                        response = urllib2.urlopen('http://softxide.com/iot/home_auto/buttonStatus.php')
                        status = response.read()
                except urllib2.HTTPError, e:
                                        print e.code

                except urllib2.URLError, e:
                                        print e.args

                print status
                if status=='ON':
                print "setting GPIO 26 "
                GPIO.output(26,True)
                elif status=='OFF':
                                GPIO.output(26,False)
On the pi open terminal and run the test.py
Code:
//Open a terminal
//Run these
             sudo chmod a+x test.py
//Then
             sudo python -i test.py
//And it should work
 
Last edited:

Thread Starter

Parth786

Joined Jun 19, 2017
642
Ok I played with this a bit and it works if you run this file as is no changes and open there page and click on the on and off buttons it will.
But befor you try let's go over some stuff
First off python uses indentation to tell where the if then ends while loop ends you mess with the indentation the file will error and not run so this is what I do
I use linux and Scite I think it will work on windows what Scite does is it let you test your code
You set it for python and test for indentation and if it's ok you can try it out
To run this you save as say test.py
Scite is text editor
Do I have to test the python code with Scite on Windows or raspberry pi?
I think I have to download scite on raspbain and I have to test python code to find out indentation error
 
Last edited:

be80be

Joined Jul 5, 2008
2,395
If you use the code I just posted it should work I had to fix indentation.
Try it first

Scite is text editor
Yes it's good one to work's great on linux I think it work on windows to but may have problems with python not being the same on the pi

Theres only one more thing that I may have and you don't on your pi
I installed pibrella
sudo apt-get install python-pip
sudo pip install pibrella

You'll want pibrella it's great
 
Last edited:

Thread Starter

Parth786

Joined Jun 19, 2017
642
If you use the code I just posted it should work I had to fix indentation.
Try it first
Now I have installed pibrella
sudo apt-get install python-pip
sudo pip install pibrella

pi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo chmod a+x test.pypi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo python -i test.py
File "test.py", line 19
print "setting GPIO 26 "
^
IndentationError: expected an indented block
 
Last edited:

Thread Starter

Parth786

Joined Jun 19, 2017
642
Now I am getting this error
Code:
pi@raspberrypi:~ $ cd Downloads/Raspi_IoT_Home_Auto-master
pi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo chmod a+x test.pypi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master $ sudo python -i test.py<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

^A<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

^A<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>

<html>
<head>
<title>Error 404 - Page Not Found</title>
<meta http-equiv="Refresh" content="1;url=http://www.hostinger.in/error_404" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-66279436-1', 'auto');
ga('send', 'pageview');
window.location = "http://www.hostinger.in/error_404";
</script>
</head>
<body></body>
</html>
 

be80be

Joined Jul 5, 2008
2,395
LOl Tsan the code I posted is the same as yours

I don't no how Parth is messing up the Indentation

And whats this
sudo chmod a+x test.pypi@raspberrypi:~/Downloads/Raspi_IoT_Home_Auto-master

I didn't say to do that
 

be80be

Joined Jul 5, 2008
2,395
Yell it's messed it up. I downloaded yours it was right when I opened it
Python is picky about indention

I took screen shots
this is wrong indention
Screenshot from 2017-12-10 16-42-10.png

This is right indention
Screenshot from 2017-12-10 16-42-40.png
 

Thread Starter

Parth786

Joined Jun 19, 2017
642
I am very happy to do this project but there are some drawbacks in this project. Anyone can control your device. I want to remove this draw back.

Can it be possible to control it only myself with password. If someone know password then he can control?
 

Thread Starter

Parth786

Joined Jun 19, 2017
642

Thread Starter

Parth786

Joined Jun 19, 2017
642
You would want set up your own web server
The whole code have to be changed
How will you control your home device from outside home network ? I think ISP provider will not allow to run web server at home. Might be they will take some charges . I don't think that you will run server at home

I want to do this, I am also looking for soluation to all these problems

How will you control your home device from outside your country ?
 
Top