
Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net
This is an extremely simple plasmoid written in python. It fetches weather information from google.com. It lets you configure the location and unit of the weather information.
Please feel free to send me bug reports and / or suggestions for improvement.
INSTALL:
$ plasmapkg -i plasma_pyweather.plasmoid
UPDATE:
I used the weather icons from here.
http://www.kde-look.org/content/show.php/Weather+Icons?content=84533
So, the credit goes to the original artist, painkiller10.
Note: I have implemented only for certain number of weather conditions, if you see a question mark image as weather conditions, please let me know, which condition it is and I will add the image for it.
10 years ago
2010-07-09:
For version: 1.7
- Fixed a typo
- Now doesn't crash when running without internet
2010-03-04:
For version: 1.6
- Fixed the bug with wrong calculation of Imperial units
- Changed the name of the images from *.svgz to *.svg, because the new KDE - 4.4 stupidly considered all *.svgz files as gzip file and showed no images
2010-01-18:
For Version: 1.5
Changed the names of the units from US t Imperial and SI to Metric to be technically correct.
WARNING: If you already have an old config, you will get N/A for all temperatures until you select the proper unit system from the settings.
2010-01-13:
For Version 1.4:
Raffaele kindly submitted a patch for the bug fix. I didn't even know about the bug as it appears only for certain cities. Now the plasmoid can deal with incorrect format of wind condition.
For version 1.3
- Fixed the bug in Kubuntu. Now it is possible to save settings.
- Added new conditions for overcast, smoky and snow
for version 1.2
- Bug Fix:
Although, I could not reproduce the bug reported by many, about th configuration, I hope to have fixed it.
For version 1.1
- Bug Fix:
Now, the parameters are url-encoded to allow city names with spaces, thanks to Virginia Brassesco for pointing out the bug.
10 years ago
2010-07-09:
For version: 1.7
- Fixed a typo
- Now doesn't crash when running without internet
2010-03-04:
For version: 1.6
- Fixed the bug with wrong calculation of Imperial units
- Changed the name of the images from *.svgz to *.svg, because the new KDE - 4.4 stupidly considered all *.svgz files as gzip file and showed no images
2010-01-18:
For Version: 1.5
Changed the names of the units from US t Imperial and SI to Metric to be technically correct.
WARNING: If you already have an old config, you will get N/A for all temperatures until you select the proper unit system from the settings.
2010-01-13:
For Version 1.4:
Raffaele kindly submitted a patch for the bug fix. I didn't even know about the bug as it appears only for certain cities. Now the plasmoid can deal with incorrect format of wind condition.
For version 1.3
- Fixed the bug in Kubuntu. Now it is possible to save settings.
- Added new conditions for overcast, smoky and snow
for version 1.2
- Bug Fix:
Although, I could not reproduce the bug reported by many, about th configuration, I hope to have fixed it.
For version 1.1
- Bug Fix:
Now, the parameters are url-encoded to allow city names with spaces, thanks to Virginia Brassesco for pointing out the bug.
p1co
5 years ago
OS: OpenSuse 13.2
Keep getting a 'Script initialization failed' error when I try to add the pyWeather widget downloaded via Plasma Desktop Shell.
I have python-kde and python-kde4 installed. Any idea on how to fix this?
Report
rrhaskin
5 years ago
Thanks in advance
Report
fixfast
7 years ago
However the scripts are nicely structured and thus can be made to work with api.openweathermap.org to again have a nice weather plasmoid.
Report
xyzzymagicat
7 years ago
Report
Senth
8 years ago
import sys, urllib, urllib2, codecs
on line 32 change:
sock = urllib.urlopen(strUrl)
to
sock = urllib2.urlopen(strUrl,timeout=15)
In addition because pyWeather polled googles api too often (every 30sec) I got blocked, so I changed the polling interval to 15 minutes in main.py
main.py:
#self.timer.start(0.5*60000)
self.timer.start(15 * 60 * 1000) #min * sec * ms
Report
snoxu
8 years ago
Report
gosom
8 years ago
When I rebooted kde could not load.
I booted to failsafe and deleted:
rm ~/.kde4/config/plas*
and then i managed to login normal.
Then I tried to install pyweather without being connected to the internet and desktop frozen.
Report
gosom
8 years ago
sock = urllib.urlopen(strUrl)
you need a timeout there so change line 10
old: import sys, urllib, codecs
new: import sys, urllib, urllib2, codecs
and line 32
old: sock = urllib.urlopen(strUrl)
new : sock = urllib2.urlopen(strUrl, timeout=1)
so it justs waits 1 second and if no connection
throws exception and the load continues
Report
XZaka
10 years ago
this is the installation process:
[email protected]:~/Downloads$ plasmapkg -i plasma_pyweather.plasmoid
"KConfigIni: In file /tmp/kde-zaka/plasmapkgEpVWz4/metadata.desktop, line 1: " Invalid entry (missing ']')
"KConfigIni: In file /tmp/kde-zaka/plasmapkgEpVWz4/metadata.desktop, line 2: " Invalid entry (missing '=')
"KConfigIni: In file /tmp/kde-zaka/plasmapkgEpVWz4/metadata.desktop, line 3: " Invalid entry (missing '=')
"KConfigIni: In file /tmp/kde-zaka/plasmapkgDiLASf/metadata.desktop, line 1: " Invalid entry (missing ']')
"KConfigIni: In file /tmp/kde-zaka/plasmapkgDiLASf/metadata.desktop, line 2: " Invalid entry (missing '=')
"KConfigIni: In file /tmp/kde-zaka/plasmapkgDiLASf/metadata.desktop, line 3: " Invalid entry (missing '=')
plasmapkg(18071)/libplasma Plasma::Package::installPackage: Package plugin name not specified
Installation of /home/zaka/Downloads/plasma_pyweather.plasmoid failed.
Report
rangalo
10 years ago
Looks like you have hit the following bug:
https://bugs.kde.org/show_bug.cgi?id=249980
They have also suggested a workaround in the comment #2.
Here the link to the workaround.
https://bugs.kde.org/show_bug.cgi?id=249980#c2
Please try and let me know, if it works.
Report
mattheyu
11 years ago
It currently states the the high for tomorrow is 127 F. I know it gets pretty warm in Texas, but not quite that hot.
I assume the applet is fetching the temperature in Celsius and then converting it, but there is an error in the formula. I'd fix it myself, but I'm not sure where to start.
Report
tuxmm
11 years ago
Fahrenheit= [(9/5)*Celsius + 32]
Example: Fahr.= [(9/5)*6 +32]= 42.8 I think the plasmoid was giving somewhere around 83.
Good luck fixing this code! Your weather applet is the best I've tried, so I look forward seeing the Imperial temperatures fixed.
Best to you!
Report
rangalo
11 years ago
There is a bug !
I just fixed it locally and will upload the fixed version soon.
Actually, I was using the same formula, but the change of the names of the units (Metric and Imperial) introduced this bug.
With the new upload the bug should be fixed.
Thanks and sorry for the annoyance.
Report
pariah2707
11 years ago
Thanks for your great work, I love its simplicity.
My problem is that a message of "This object could not be created for the following reason: Script initialization failed" would appear if I want to set my location to Hong Kong.
It worked flawlessly for other locations like Munich, Beijing or Macau. I tried "Hong Kong,Hong Kong", "HongKong,HongKong", "HongKong," and "HongKong" in google, i.e.
http://www.google.com/ig/api?weather=mylocation, all seems to give correct result. But if I have these setting in the configuration, it just wouldn't work.
Hard-coding my location into main.py and weatherConfig.py gives the same error.
I'm using Kubuntu 9.10. Thanks.
Report
rangalo
11 years ago
Raffaele has submitted a nice patch and the bug has bin fixed in the latest version 1.4 of the plasmoid.
Report
DevilMayCry
11 years ago
(It´s translated from German into English)
Report
rangalo
11 years ago
1. download the plasmoid file.
2. plasmapkg -i <path_to_plasmoid_file>
Make sure you don't have the older version of the plasmoid.
plasmapkg -l | grep weather
Above command will give list of weather plasmoids installed.
plasmapkg -r plasma_pyweather
above command will remove the older version if already installed.
Then reinstall.
Report
DevilMayCry
11 years ago
Report
rangalo
11 years ago
I don't have any clue why the installation fails in your case from the error message.
Report
DevilMayCry
11 years ago
Thanks for your help!
Report
rangalo
11 years ago
Also added new conditions for overcast, fog, snow and smoke.
Report
brucew
11 years ago
It loses all the settings at every reboot.
Please advise.
Report
jmatter
11 years ago
Report
rangalo
11 years ago
It is easy to change the default location.
Moreover, you should have a file .weather.cfg file in you home folder. You can also edit the file manually and set the location there.
Meanwhile, I am now back from vacation and try to fix the issue permanently. Actually, I use debian and I haven't had this problem.
Thanks,
Hardik
Report
eprosen
11 years ago
http://ubuntuforums.org/showthread.php?t=878457
then plasmapkg command worked.
the previous idea of creating a new user account came from here:
http://code.google.com/p/gmail-plasmoid/issues/detail?id=8
Thanks rangalo for your help ... I stay in canada and will inform you if the plasmoid runs out of icons in the winter!
Cheers!
Report