Skip navigation.
KDE Developer's Journals

And now the Programming Plasma with Python tutorial you've all been googling for...

simon edwards's picture

In a great demonstration that not only do great minds think alike, they can also subconsciously syncronise to attack the same problem, Luca Beltrame and I started work on our own tutorials about writing Plasma applets using Python at exactly the same time and day this weekend. We've coordinated ourselves and now there are 3 new tutorials about programming Plasma applets with Python up on techbase. The first tutorial by myself is an introduction to the whole work cycle of creating an applet. Luca continues in the second tutorial with how to use Plasma widgets in an applet. And today I've written another tutorial about how to use DataEngines in an applet.

All three are available from the Plasma tutorials page on KDE techbase.

As always KDE isn't a spectator sport, so you are welcome to add to the tutorials on techbase. Enjoy.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
behavedave's picture

The python script engine that couldn't :(

I very much appreciate what you have done here as this will get me a great way in to my little project to integrate Google's tools in to the Plasma desktop. Well I have a long way to go but seeing as I am scratching my own itch I have some impetus at least.

The bad news: The plasmoid created in the first tutorial shoots back at me:

"Could not create a python script engine for the hello python widget"

and I have the python-plasma package installed so where could I have gone wrong.

Here the CLI output if it helps:

plasmoidviewer(9655) KServiceFactory::findServiceByDesktopPath: "findServiceByDesktopPath:  not found"                                                               
plasmoidviewer(9655): couldn't create slave: "Unable to create io-slave:          
klauncher said: Unknown protocol ''.                                              
"                                                                                 
Traceback (most recent call last):                                                
  File "/usr/share/kde4/apps/plasma_scriptengine_python/pyappletscript.py", line 19, in <module>                                                                     
    from PyQt4.QtCore import *                                                    
ImportError: /usr/lib/python2.5/site-packages/PyQt4/QtCore.so: undefined symbol: PyExc_ValueError                                                                    
Error in sys.excepthook:                                                          
Traceback (most recent call last):                                                
  File "/usr/lib/python2.5/site-packages/apport_python_hook.py", line 38, in apport_excepthook                                                                       
    from apport.packaging_impl import impl as packaging                           
  File "/usr/lib/python2.5/site-packages/apport/__init__.py", line 1, in <module> 
    from apport.report import Report
  File "/usr/lib/python2.5/site-packages/apport/report.py", line 14, in <module>
    import subprocess, tempfile, os.path, urllib, re, pwd, grp, os, sys
  File "/usr/lib/python2.5/subprocess.py", line 401, in <module>
    import select
ImportError: /usr/lib/python2.5/lib-dynload/select.so: undefined symbol: PyExc_ValueError

Original exception was:
Traceback (most recent call last):
  File "/usr/share/kde4/apps/plasma_scriptengine_python/pyappletscript.py", line 19, in <module>
    from PyQt4.QtCore import *
ImportError: /usr/lib/python2.5/site-packages/PyQt4/QtCore.so: undefined symbol: PyExc_ValueError

Thanks & regards
Dave Taylor

madsdyd's picture

For *ubuntu, try installing python-dev

Had similar problems, they went away when installing package python-dev.

Dunno why, something with dynamic/static linking I think.

Regards

Mads

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.