Closed 0xh0n3y closed 4 years ago
i had created the issue : bottlepy/bottle#1176 Issue is still not fixed.
It is not fixed because it is not an issue with bottle, but your application. And you closed bottlepy/bottle#1176 before opening this issue, so I assume you came to the same conclusion.
@0xh0n3y But there needs to be a flot/
directory. What does the book say what you have to do to get this example up and running?
It's bottle server WSGIRefServer issue which doesn't load the flot files even when the flot directory is been made and contains the piweather.pi file in it. Somehow the issue has been fixed now.
It's bottle server WSGIRefServer issue
No. It's not. You either did not have a flot
directory with js files in place, or started the server from a different working directory. flot
is a relative path (same as ./flot/
) so the current working directory matters. There is no bug or issue with bottle and/or WSGIRefServer.
All the js files have been in flot directory i followed all the steps according to book and also created a flot directory where all the js files are placed but server was not able to load js flot files from the python piweather.py code .
Firstly as i followed the steps acc. to book it had created /home/pi/myProjectDir/ and acc. to that flot is been moved to myProjectDir/ but it won't work then after i moved it to the /root/flot directory by manually creating that directory and run the code from that directory but it won't either and you think i didn't tried that.
Issue wasn't fixed i changed my mind to switch to the different method to get temperature and humidity sensor data from DHT11 but if you can tell me in which directory i should the code of flot and where to keep the piweather.py file. One thing i should make clear is that js flot can't plot the data on the localhost and which specific ip address should i use with the piweather.py file while executing the code from terminal.
Software does not magically not work and then fix itself. Neither bottle nor WSGIRefServer changed between your first try (which did not work) and your last (which did work, apparently?). So you must have changed something yourself. If you want to learn anything from this issue, find out what the difference was, and understand why it makes a difference.
Again: The current working directory (the directory you are in when you start a python program) does matter. piweather.py
will look for js files in ./flot/
directory relative to the current working directory, and NOT relative to itself.
File permissions also matter. If you run piweather.py
as the user pi
but created the flot
directory as root, then bottle won't be able to read these files.
I will be checking it for few minutes don't close the issue.
Man i tried alot eve changing the permissions for the file but it does fix the issue.Can you suggest something.
root@raspberrypi:~/flot# sudo python piweather.py --ip localhost --port 8080 starting piweather... Bottle v0.12.17 server starting up (using WSGIRefServer())... Listening on http://localhost:8080/ Hit Ctrl-C to quit.
127.0.0.1 - - [02/Nov/2019 18:45:16] "GET /plot HTTP/1.1" 200 3396 127.0.0.1 - - [02/Nov/2019 18:45:18] "GET /jquery.js HTTP/1.1" 404 725 127.0.0.1 - - [02/Nov/2019 18:45:18] "GET /jquery.flot.js HTTP/1.1" 404 730 127.0.0.1 - - [02/Nov/2019 18:45:18] "GET /jquery.flot.time.js HTTP/1.1" 404 735 127.0.0.1 - - [02/Nov/2019 18:45:19] "GET /jquery.js HTTP/1.1" 404 725 127.0.0.1 - - [02/Nov/2019 18:45:19] "GET /jquery.flot.js HTTP/1.1" 404 730 127.0.0.1 - - [02/Nov/2019 18:45:19] "GET /jquery.flot.time.js HTTP/1.1" 404 735 127.0.0.1 - - [02/Nov/2019 18:45:22] "GET /favicon.ico HTTP/1.1" 404 742
root@raspberrypi:~/flot# ls -l total 1032 -rw-r----- 1 pi pi 53572 Apr 21 2014 API.md -rw-r----- 1 pi pi 3242 Apr 21 2014 CONTRIBUTING.md drw-r----- 31 pi pi 4096 Apr 21 2014 examples -rw-r----- 1 pi pi 41943 Apr 21 2014 excanvas.js -rw-r----- 1 pi pi 19314 Apr 21 2014 excanvas.min.js -rw-r----- 1 pi pi 3237 Apr 21 2014 FAQ.md -rw-r----- 1 pi pi 6151 Apr 21 2014 jquery.colorhelpers.js -rw-r----- 1 pi pi 3134 Apr 21 2014 jquery.colorhelpers.min.js -rw-r----- 1 pi pi 9599 Apr 21 2014 jquery.flot.canvas.js -rw-r----- 1 pi pi 3953 Apr 21 2014 jquery.flot.canvas.min.js -rw-r----- 1 pi pi 6033 Apr 21 2014 jquery.flot.categories.js -rw-r----- 1 pi pi 2598 Apr 21 2014 jquery.flot.categories.min.js -rw-r----- 1 pi pi 5419 Apr 21 2014 jquery.flot.crosshair.js -rw-r----- 1 pi pi 2162 Apr 21 2014 jquery.flot.crosshair.min.js -rw-r----- 1 pi pi 12614 Apr 21 2014 jquery.flot.errorbars.js -rw-r----- 1 pi pi 5453 Apr 21 2014 jquery.flot.errorbars.min.js -rw-r----- 1 pi pi 5257 Apr 21 2014 jquery.flot.fillbetween.js -rw-r----- 1 pi pi 2309 Apr 21 2014 jquery.flot.fillbetween.min.js -rw-r----- 1 pi pi 7360 Apr 21 2014 jquery.flot.image.js -rw-r----- 1 pi pi 2683 Apr 21 2014 jquery.flot.image.min.js -rw-r----- 1 pi pi 122971 Apr 21 2014 jquery.flot.js -rw-r----- 1 pi pi 52966 Apr 21 2014 jquery.flot.min.js -rw-r----- 1 pi pi 14216 Apr 21 2014 jquery.flot.navigate.js -rw-r----- 1 pi pi 6568 Apr 21 2014 jquery.flot.navigate.min.js -rw-r----- 1 pi pi 23809 Apr 21 2014 jquery.flot.pie.js -rw-r----- 1 pi pi 12183 Apr 21 2014 jquery.flot.pie.min.js -rw-r----- 1 pi pi 3314 Apr 21 2014 jquery.flot.resize.js -rw-r----- 1 pi pi 2344 Apr 21 2014 jquery.flot.resize.min.js -rw-r----- 1 pi pi 13141 Apr 21 2014 jquery.flot.selection.js -rw-r----- 1 pi pi 5271 Apr 21 2014 jquery.flot.selection.min.js -rw-r----- 1 pi pi 7090 Apr 21 2014 jquery.flot.stack.js -rw-r----- 1 pi pi 2465 Apr 21 2014 jquery.flot.stack.min.js -rw-r----- 1 pi pi 2505 Apr 21 2014 jquery.flot.symbol.js -rw-r----- 1 pi pi 1187 Apr 21 2014 jquery.flot.symbol.min.js -rw-r----- 1 pi pi 4480 Apr 21 2014 jquery.flot.threshold.js -rw-r----- 1 pi pi 1840 Apr 21 2014 jquery.flot.threshold.min.js -rw-r----- 1 pi pi 11768 Apr 21 2014 jquery.flot.time.js -rw-r----- 1 pi pi 6891 Apr 21 2014 jquery.flot.time.min.js -rw-r----- 1 pi pi 266057 Apr 21 2014 jquery.js -rw-r----- 1 pi pi 142303 Apr 21 2014 jquery.min.js -rw-r----- 1 pi pi 1069 Apr 21 2014 LICENSE.txt -rw-r----- 1 pi pi 285 Apr 21 2014 Makefile -rw-r----- 1 pi pi 40290 Apr 21 2014 NEWS.md -rw-r----- 1 pi pi 4799 Nov 1 09:49 piweather.py -rw-r----- 1 pi pi 4340 Apr 21 2014 PLUGINS.md -rw-r----- 1 pi pi 3782 Apr 21 2014 README.md -rw-r----- 1 pi pi 863 Oct 30 15:54 simple-flot.html -rw-r----- 1 pi pi 2409 Oct 30 15:55 test.py -rw-r----- 1 pi pi 1247 Oct 30 15:55 time-flot.html
root@raspberrypi:~/flot# exit exit
pi@raspberrypi:~ $ ls Adafruit_Python_DHT dht-11.py Downloads MagPi Pictures Templates Desktop Documents flot-0.8.3.zip Music Public Videos
pi@raspberrypi:~ $ ls -l total 680 drwxr-xr-x 10 pi pi 4096 Oct 30 13:50 Adafruit_Python_DHT drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Desktop -rw-r--r-- 1 pi pi 435 Nov 2 18:17 dht-11.py drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Documents drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Downloads -rw-r--r-- 1 pi pi 649913 Aug 29 20:30 flot-0.8.3.zip drwxr-xr-x 2 pi pi 4096 Sep 26 05:48 MagPi drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Music drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Pictures drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Public drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Templates drwxr-xr-x 2 pi pi 4096 Sep 26 06:02 Videos
pi@raspberrypi:~ $ cd Adafruit_Python_DHT/
pi@raspberrypi:~/Adafruit_Python_DHT $ ls -l total 44 drw-r----- 2 pi pi 4096 Oct 30 13:49 Adafruit_DHT drwxr-xr-x 2 root root 4096 Oct 30 13:49 Adafruit_DHT.egg-info drwxr-xr-x 5 root root 4096 Oct 30 13:50 build drwxr-xr-x 2 root root 4096 Oct 30 13:50 dist drw-r----- 2 pi pi 4096 Oct 30 13:49 examples -rw-r----- 1 pi pi 1085 Oct 30 13:49 LICENSE -rw-r----- 1 pi pi 45 Oct 30 13:49 MANIFEST.in -rw-r----- 1 pi pi 2038 Oct 30 13:49 README.md -rw-r----- 1 pi pi 5130 Oct 30 13:49 setup.py drw-r----- 6 pi pi 4096 Oct 30 13:49 source
pi@raspberrypi:~/Adafruit_Python_DHT $
root@raspberrypi:~/flot# sudo python piweather.py --ip localhost --port 8080
If you are in ~/flot/
and starting piweather.py
, it will search for static files in ~/flot/flot/
which does not exist. I'm not sure what is so hard to understand here.
It should look like this:
~/myProject/piweather.py
~/myProject/flot/jquery.js
~/myProject/flot/... (more js files)
Then go to ~/myProject/
and run python piweather.py --ip localhost --port 8080
.
Server error fixed . Thanks man. Issue fixed . Project done.
keep getting error: pi@raspberrypi:~/myProjectDir $ sudo python piweather.py --ip localhost --port 8080 starting piweather... piweather.py:208: RuntimeWarning: This channel is already in use, continuing anyway. Use GPIO.setwarnings(False) to disable warnings. GPIO.setup(18, GPIO.OUT) Bottle v0.12.17 server starting up (using WSGIRefServer())... Listening on http://localhost:8080/ Hit Ctrl-C to quit.
127.0.0.1 - - [31/Oct/2019 16:34:31] "GET /plot HTTP/1.1" 200 3396 127.0.0.1 - - [31/Oct/2019 16:34:38] "GET /jquery.js HTTP/1.1" 404 725 127.0.0.1 - - [31/Oct/2019 16:34:39] "GET /jquery.flot.js HTTP/1.1" 404 730 127.0.0.1 - - [31/Oct/2019 16:34:39] "GET /jquery.flot.time.js HTTP/1.1" 404 735
no flot/ directory is found in OS.
the code i used is same and code file are placed in /myProjectDir/ where all the jquery files are placed which are not loading. https://raw.githubusercontent.com/electronut/pp/master/piweather/piweather.py
plz tell where to place the piweather.py file so that the server loads the jquery file and where to change the file.
i had created the issue : https://github.com/bottlepy/bottle/issues/1176 Issue is still not fixed.