[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    KRunner plug-ins in python - The package name changes during execution(???)
From:       Giacomo Alzetta <giacomo.alzetta () gmail ! com>
Date:       2012-11-07 21:41:08
Message-ID: 1568150.dnW60WZ0bG () jack-laptop
[Download RAW message or body]

I've come across a strange behaviour when writing a runner for KRunner.

The name of my package that implements the runner is "pseudocode" but it 
becomes "runner_pseudocode_runner.pseudocode" during execution and this 
*breaks* my code.

My runner has to do some queries to a sqlite database in which some python 
objects are pickled. These object are created from the pseudocode package, but 
since the package name changes during execution pickle cannot find the classes 
to unpickle them.

An example traceback:

Traceback (most recent call last):
  File "/usr/share/kde4/apps/plasma_scriptengine_python/pyrunner.py", line 71, 
in match
    self.pyrunner.match(search)
  File 
"/home/giacomo/.kde/share/apps/plasma/runners/pseudocode_runner/contents/code/pseudocode/runner.py", 
line 124, in match
    self._literal_search(normalized_query, context, database)
  File 
"/home/giacomo/.kde/share/apps/plasma/runners/pseudocode_runner/contents/code/pseudocode/runner.py", 
line 92, in _literal_search
    results_by_author):
  File 
"/home/giacomo/.kde/share/apps/plasma/runners/pseudocode_runner/contents/code/pseudocode/runner.py", 
line 86, in <genexpr>
    results_by_title = ((match, match.title == query)
  File 
"/home/giacomo/.kde/share/apps/plasma/runners/pseudocode_runner/contents/code/pseudocode/db.py", 
line 271, in _get_pseudocode_no_tags
    match_tag_ids)
  File 
"/home/giacomo/.kde/share/apps/plasma/runners/pseudocode_runner/contents/code/pseudocode/db.py", 
line 154, in _make_pseudocode
    code=pickle.loads(result[self._CODE_INDEX].encode('utf-8')),
ImportError: No module named pseudocode.code


I tried to look into the user .kde directories but I do not see and 
__init__.py file in the directory tree and also the name of those directories 
do not match with the name I see in the exceptions.[A research over the whole 
file system did not discover any "runner_pseudocode_runner" directory...]

What is happening? Is this an expected behaviour? I could not find any mention 
of something like this on the internet.


Some versions:

KDE 4.8.5
Qt 4.8.1
PyKDE 4.0.2
PyQt 4.9.1
Python 2.7.3


>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic