I'm starting to learn using Pyke. I almost read everything in the documentation and I'm trying to re-create the family_relations example.
I have these files:
family.father_son($father, $son, ())
family.father_son($father, $grand_son, ())
family.father_son($grand_father, $father, ())
family.father_son($grand_father, $grand_son, (grand))
family.father_son($father, $gg_son, ())
family.father_son($gg_father, $father, ($prefix1, *$rest_prefixes))
family.father_son($gg_father, $gg_son, (great, $prefix1, *$rest_prefixes))
from pyke import knowledge_engine
my_engine = knowledge_engine.engine('.')
When I run test.py I get this error:
Traceback (most recent call last):
File "test.py", line 9, in <module>
File "build/bdist.linux-i686/egg/pyke/knowledge_engine.py", line 134, in activate
File "build/bdist.linux-i686/egg/pyke/rule_base.py", line 107, in activate
File "build/bdist.linux-i686/egg/pyke/rule_base.py", line 91, in register_fc_rules
File "build/bdist.linux-i686/egg/pyke/fc_rule.py", line 79, in register_rule
File "build/bdist.linux-i686/egg/pyke/knowledge_engine.py", line 97, in get_kb
KeyError: 'knowledge_base family not found'
What am I doing wrong?
Thanks for your help.
There are two possible problems.
But first, I want to just let you know that the documentation was overhauled significantly in the new 0.4 release. If you are reading the documentation from a prior release, I would strongly recommend that you switch to the 0.4 documentation.
OK, back to your problem. The most likely cause of your problem is that you are running an older version of Pyke. To use the new .kfb files, you need version 0.4. To check this:
>>> import pyke
If that's not it, then you must have the family.kfb file in a different location than the fc_example.krb file so that Pyke isn't finding it.
Let me know if neither of these is the problem.
I also want to point out that the subversion version of pyke is currently broken, so take the 0.4 release version (such as by using easy_install).
Well, I checked and I still have the older Pyke version. So I think you're right about the problem. Anyway, I tried to run the same example, but from the shell and it worked. Is it normal?
Now I'd like to install the new version. I have a problem with easy_install. When I do:
sudo easy_install-2.5 pyke
I get this error:
error: Couldn't find a setup script in pyke
I've tried installing again easy_install, but it's the same.
What can I do?
Sorry for double posting, but I just solved the problem.
It worked with:
sudo easy_install-2.5 pyke-0.4.tar.gz
Anyway, I am curious to know what was the problem with:
sudo easy_install-2.5 pyke
inside the directory.
I removed the egg file of the version 0.3, from the site-packages directory. Are there other files to remove?
I'm not sure what the problem was. If you have an old version of a program, you can run:
easy_install --upgrade pyke
and it should fix you up. This does not delete the old version, just takes it off of the python path. Just delete the old .egg file in the site-packages directory.
I tried installing pyke from scratch (no previous version installed) with easy_install and it worked fine.
Trying "easy_install pyke" with pyke 0.3 already installed (by easy_install), it doesn't seem to do anything, just says that pyke is already installed. (But doesn't generate an error either).
Then doing "easy_install --upgrade pyke" installs the 0.4 release, putting 0.4 on the python path rather than 0.3 but does not delete the 0.3 egg file.
So I don't see any problem with the pyke installation.
Sounds like you should be OK now!
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.