Closed hotice closed 11 years ago
Hi,
I seem to get the same error when there is no 'topdirs' variable in the ~/.recoll/recoll.conf file. It's not there by default after recoll installation. Maybe you could try to add the following line to ~/.recoll/recoll.conf and see how it goes:
topdirs = ~
It does not change anything to your actual recoll config, but maybe it will make the webui happy because it does try to parse the config file
Main page works with this trick, when you try to search you get: (I assume it is still an error with the missing config)
Sorry, the requested URL 'http://localhost:8080/results?query=test&dir=%3Call%3E&after=&before=&sort=mtime&ascending=0&page=1' caused an error:
Internal Server Error Exception:
AttributeError("'module' object has no attribute 'connect'",) Traceback:
Traceback (most recent call last): File "/home/xsebi/programs/recoll/recoll-webui/bottle.py", line 744, in _handle return route.call(_args) File "/home/xsebi/programs/recoll/recoll-webui/bottle.py", line 1479, in wrapper rv = callback(_a, _ka) File "/home/xsebi/programs/recoll/recoll-webui/bottle.py", line 2850, in wrapper result = func(_args, **kwargs) File "/home/xsebi/programs/recoll/recoll-webui/webui.py", line 223, in results res, nres, timer = recoll_search(query) File "/home/xsebi/programs/recoll/recoll-webui/webui.py", line 170, in recoll_search db = recoll.connect(config['confdir']) AttributeError: 'module' object has no attribute 'connect'
I think that the error is due to the different module structure in the latest recoll releases. I don't feel like learning to use github for such a trivial patch, so here it is:
diff --git a/webui.py b/webui.py
index 79c91e1..174a1de 100755
--- a/webui.py
+++ b/webui.py
@@ -3,7 +3,10 @@
import os
import bottle
import time
-import recoll
+try:
+ from recoll import recoll
+except:
+ import recoll
import datetime
import glob
import hashlib
Hi,
I think I there's also an issue with the python API.
Funnily when I print the filename, I nearly get it every time, but for author I am getting never.
->when I don't ask for those values & fill ('filename', 'label' and 'author') with dummy data the web ui works :-)
Does it run on your machine?
recoll version: recoll/raring uptodate 1.19.5-1~ppa1~raring1
here is the modification I made:
diff --git a/webui.py b/webui.py
index 79c91e1..197bf3f 100755
--- a/webui.py
+++ b/webui.py
@@ -184,17 +187,24 @@ def recoll_search(q):
config['perpage'] = nres
q['page'] = 1
offset = (q['page'] - 1) * config['perpage']
- query.next = offset
- while query.next >= 0 and query.next < offset + config['perpage'] and query.next < nres:
+ # query.next = offset
+ tempCounter = 0
+ while tempCounter >= 0 and tempCounter< offset + config['perpage'] and tempCounter < nres:
doc = query.fetchone()
d = {}
for f in FIELDS:
- d[f] = getattr(doc, f).encode('utf-8')
+ tempField = getattr(doc, f)
+ try:
+ d[f] = tempField.encode('utf-8');
+ except:
+ print f
+ d[f] = 'not working' + f
d['label'] = select([d['title'], d['filename'], '?'], [None, ''])
d['sha'] = hashlib.sha1(d['url']+d['ipath']).hexdigest()
d['time'] = timestr(d['mtime'], config['timefmt'])
d['snippet'] = db.makeDocAbstract(doc, query).encode('utf-8')
results.append(d)
+ tempCounter = tempCounter +1
tend = datetime.datetime.now()
return results, nres, tend - tstart
#}}}
coding-green writes:
Hi,
I think I there's also an issue with the python API.
- it says that query.next got readonly (Line 191)
- when I tried to fake query.next with a normal increasing counter, I got a AttributeError("'NoneType' object has no attribute 'encode'",) for the following keywords: 'filename', 'author', 'keywords','time', 'snippet', 'label',
Funnily when I print the filename, I nearly get it every time, but for author I am getting never.
->when I don't ask for those values & fill ('filename', 'label' and 'author') with dummy data the web ui works :-)
Does it run on your machine?
Hi,
I'm not exactly sure what happens with the change you sent because the diff is looking funny, so it's difficult to read.
Anyway, the attached diff (against the current git repository) gets the webui working with any of recoll 1.17, 1.18 or 1.19 installed (on my system, which has Python 2.7.3)
The manual page is now up to date on the web site. There are a few compatibility notes at the end: file:///home/dockes/projets/fulltext/recoll/src/doc/user/RCL.PROGRAM.API.html#RCL.PROGRAM.API.PYTHON
The changes are that:
Mostly the changes were made to stay as close as possible to the Python standard DB API.
Please try the patch and tell me if any compatibility problem remains. As far as I know, it's quite possible to have code which runs with all versions without too many contorsions...
Cheers,
jf
I am getting a 500 error with the following output from terminal. I just downloaded the cod so it seems to be the up to date version. same thing with default port (8080)
The interface looks great. I hope I can get it working. Any ideas what is going wrong here? Thanks.
./webui-standalone.py
Bottle server starting up (using WSGIRefServer())...
Listening on http://localhost:8181/
Hit Ctrl-C to quit.
127.0.0.1 - - [26/Sep/2013 18:38:55] "GET / HTTP/1.1" 200 745150
127.0.0.1 - - [26/Sep/2013 18:38:56] "GET /static/style.css HTTP/1.1" 200 3207
127.0.0.1 - - [26/Sep/2013 18:38:56] "GET /static/jquery.js HTTP/1.1" 200 93637
127.0.0.1 - - [26/Sep/2013 18:38:56] "GET /static/extra.js HTTP/1.1" 200 684
127.0.0.1 - - [26/Sep/2013 18:38:56] "GET /static/jdpicker.js HTTP/1.1" 200 21159
127.0.0.1 - - [26/Sep/2013 18:38:56] "GET /static/jdpicker.css HTTP/1.1" 200 3453
127.0.0.1 - - [26/Sep/2013 18:38:57] "GET /static/recoll.png HTTP/1.1" 200 457
Traceback (most recent call last):
File "/home/rich/git/recoll-webui/bottle.py", line 744, in _handle
return route.call(**args)
File "/home/rich/git/recoll-webui/bottle.py", line 1479, in wrapper
rv = callback(*a, **ka)
File "/home/rich/git/recoll-webui/bottle.py", line 2850, in wrapper
result = func(*args, **kwargs)
File "/home/rich/git/recoll-webui/webui.py", line 253, in results
res, nres, timer = recoll_search(query)
File "/home/rich/git/recoll-webui/webui.py", line 194, in recoll_search
nres = query.rowcount
AttributeError: 'recoll.Query' object has no attribute 'rowcount'
127.0.0.1 - - [26/Sep/2013 18:39:03] "GET /results?query=thunder&dir=%3Call%3E&after=&before=&sort=relevancyrating&ascending=0&page=1 HTTP/1.1" 500 1758
127.0.0.1 - - [26/Sep/2013 18:39:03] "GET /favicon.ico HTTP/1.1" 404 742
Hi,
I would guess that you are running recoll 1.17 ? I just realized that the compatibility of the webui with this version was broken a few months ago. This was unvoluntary and I am looking for a way to restore compatibility without cluttering the webui code too much.
The Recoll Python interface was seriously changed twice recently, to conform to the newer Python database API, and then to add data access functions. This is causing a bit of trouble...
jf
(after studying the breakage, the relevant API change occurred in 1.18.2, so you might be running 1.18.1)
Recoll web start fine:
Bottle server starting up (using WSGIRefServer())... Listening on http://localhost:8799/ Hit Ctrl-C to quit.
127.0.0.1 - - [03/Oct/2013 00:33:07] "GET / HTTP/1.1" 500 756
However when I try to go to localhost:8080 I get:
Error 500: Internal Server Error
Sorry, the requested URL 'http://localhost:8080/' caused an error:
Template 'main' not found.
Can you please let me know what is going wrong?
Hi,
You should start the webui from its own directory, and there should be a subdirectory names "views/" with a main.tpl file in there. If these are already the case, I'm out of my depth...
Perfect! This update in webui.py fixed the problem. Thanks, you're a star.
Hope this project becomes part of the official recoll project.
I've tried to use this in Ubuntu 13.04 (Recoll 1.19.2-1~ppa1~raring1 install via PPA), but I get the following error:
Internal Server Error
Exception:
KeyError('topdirs',)
Traceback:
Traceback (most recent call last): File "/home/andrei/Downloads/recoll-webui/bottle.py", line 744, in _handle return route.call(_args) File "/home/andrei/Downloads/recoll-webui/bottle.py", line 1479, in wrapper rv = callback(_a, _ka) File "/home/andrei/Downloads/recoll-webui/bottle.py", line 2850, in wrapper result = func(_args, **kwargs) File "/home/andrei/Downloads/recoll-webui/webui.py", line 212, in main config = get_config() File "/home/andrei/Downloads/recoll-webui/webui.py", line 118, in get_config config['dirs'] = shlex.split(rc['main']['topdirs']) KeyError: 'topdirs'