plasma_pyweather
KDE4 Extensions
Description:

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.

Last changelog:

6 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

2 years ago

KDE version: 4.14.5
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

1 year ago

I'm getting the same error. I am running Arch, KDE-4. I have python and as many add-ons as I need as far as I know. Doesn't anyone have ideas?
Thanks in advance

Report

fixfast

4 years ago

I've spent some time before discovering Google killed it's weather api as used in this plasmoid.

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

4 years ago

The download/install widgets feature claimed that it installed PyWeather upon being asked, but unfortunately it doesn't actually show up in the list of available plasmoids. (I'm in the old KDE because I just did a clean reinstall of SimplyMepis 11.)

Report

Senth

4 years ago

in weatherInfo.py add:
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

4 years ago

Can't get this to work for some reason (Archlinux + KDE). Get a message about a python engine (in portuguese).

Report

gosom

5 years ago

I installed pyweather while connected to the internet and it worked fine.

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

5 years ago

The problem lies in line 32:
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

6 years ago

hello, cant install it, i m using debian squeeze with kde 4.5.1
this is the installation process:

zaka@debian:~/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

6 years ago

Hi,

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

7 years ago

I'm located in Waco, TX, running Kubuntu 9.10. I have the units set to imperial.

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

7 years ago

Having the same problem in openSuse 11.2 KDE 4.2.5. I would look into the source too, but don't have much time these days. However, I will provide the necessary formula in case you need it:

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

7 years ago

Hi Guys,

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

7 years ago

Hi.

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

7 years ago

This was due to wrong format of wind condition for certain cities.

Raffaele has submitted a nice patch and the bug has bin fixed in the latest version 1.4 of the plasmoid.

Report

DevilMayCry

7 years ago

As I´m trying to install the plasmoid, there´s an error message: The installation failed /home/xxxxx/plasma_pyweather.plasmoid
(It´s translated from German into English)

Report

rangalo

7 years ago

Try to install with plasmapkg command like following.

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

7 years ago

Thank you for the quick reply but it still doesn´t work! It´s not already installed and the error message is still shown. Do I need root privileges to install?

Report

rangalo

7 years ago

Generally you don't need root access for installing a plasmoid.

I don't have any clue why the installation fails in your case from the error message.

Report

DevilMayCry

7 years ago

Perhaps it´s a KDE-Bug and I guess I should wait for a new KDE 4.3 release.
Thanks for your help!

Report

rangalo

7 years ago

I have fixed the but with Kubuntu. Now it is possible to save settings.

Also added new conditions for overcast, fog, snow and smoke.

Report

brucew

7 years ago

Using Kubuntu 9.10. Installed using Plasma installer without any problem.

It loses all the settings at every reboot.

Please advise.

Report

jmatter

7 years ago

If you're comfortable monkeying around with code, it's pretty simple to change the default location from Munich to wherever you are. http://github.com/rangalo/plasma_pyweather has the source code. Go to /rangalo-plasma_pyweather-1c000f3/contents/code and open up the file main.py in your favorite text editor, go to line 44 or so, and change the default settings. You'll have to change the name of the plasmoid so it doesn't conflict with the original version when you install this, and I forget how I did that, but I have faith in you. If you need more clarification, I'll gladly try to make my explanation more straightforward.

Report

rangalo

7 years ago

You are correct.

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

7 years ago

I removed the old files using the instructions in
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

6 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.

File (click to download) Version Description Filetype Packagetype License Downloads Date Filesize OCS-Install
Score 89%
89.00 Likes
11 Dislikes
Details
version
1.7
updated Jul 09 2010
added Aug 12 2009
downloads
page views 2067