rcarmo / Yaki

A filesystem based wiki
http://the.taoofmac.com/space/projects/Yaki
55 stars 8 forks source link

TypeError on python 2.7 / Windows #6

Open tyrcho opened 12 years ago

tyrcho commented 12 years ago

cloned the repo, installed python (http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi), ran the application and I get this error while browser is stuck on http://localhost:9090/p/start, (error 503, server restarting)

D:\tmp\Yaki\yaki>app.py Wed Apr 11 16:27:59 2012 GMT Starting server on 127.0.0.1:9090 (9090) [18:28:00,server] Server starting... [18:28:00,server] Exception in thread Thread-2: Traceback (most recent call last): File "D:\dev\tools\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 94, in run self.pagescan() # Do preliminary scanning File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 334, in pagescan self.indexable.sort(lambda x, y: self.allpages[y]-self.allpages[x]) TypeError: comparison function must return int, not long [18:28:00,server] Exception in thread Thread-4: Traceback (most recent call last): File "D:\dev\tools\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 94, in run self.pagescan() # Do preliminary scanning File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 334, in pagescan self.indexable.sort(lambda x, y: self.allpages[y]-self.allpages[x]) TypeError: comparison function must return int, not long [18:28:00,server] Serving requests.

rcarmo commented 12 years ago

Hello there,

I haven't run (or tried to run) Yaki under Windows other than a few initial runs under Cygwin. That doesn't seem to be the real problem here, though - it looks more like some sort of change regarding comparison functions in Python 2.7, but I have Yaki running under Python 2.7 and Pypy on Linux and Mac without that issue ever cropping up.

So I can't really reproduce it, but you can try forcing the return from that lambda to be a an int (it's a straightforward string indexing comparison, so it can't be off for more than a few units).

On Apr 11, 2012, at 17:29 , Michel Daviot wrote:

cloned the repo, installed python (http://www.python.org/ftp/python/2.7.2/python-2.7.2.msi), ran the application and I get this error while browser is stuck on http://localhost:9090/p/start, (error 503, server restarting)

D:\tmp\Yaki\yaki>app.py Wed Apr 11 16:27:59 2012 GMT Starting server on 127.0.0.1:9090 (9090) [18:28:00,server] Server starting... [18:28:00,server] Exception in thread Thread-2: Traceback (most recent call last): File "D:\dev\tools\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 94, in run self.pagescan() # Do preliminary scanning File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 334, in pagescan self.indexable.sort(lambda x, y: self.allpages[y]-self.allpages[x]) TypeError: comparison function must return int, not long [18:28:00,server] Exception in thread Thread-4: Traceback (most recent call last): File "D:\dev\tools\Python27\lib\threading.py", line 552, in __bootstrap_inner self.run() File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 94, in run self.pagescan() # Do preliminary scanning File "D:\tmp\Yaki\yaki\userlibs\yaki\Indexer.py", line 334, in pagescan self.indexable.sort(lambda x, y: self.allpages[y]-self.allpages[x]) TypeError: comparison function must return int, not long [18:28:00,server] Serving requests.


Reply to this email directly or view it on GitHub: https://github.com/rcarmo/Yaki/issues/6

tyrcho commented 12 years ago

I converted to an int in Indexer ... now I get another error :

File "D:\tmp\Yaki\yaki\snakeserver\webapp.py", line 619, in run_snakelet snake.serve(req, resp) # <--- actual call to snakelet File "D:\tmp\Yaki\yaki\userlibs\yaki\Engine.py", line 294, in serve page = self.getPage(request, response) File "D:\tmp\Yaki\yaki\userlibs\yaki\Engine.py", line 512, in getPage page = ac.store.getRevision(path) File "D:\tmp\Yaki\yaki\userlibs\yaki\Store.py", line 121, in getRevision p = Page(buffer,BASE_TYPES[base.split('.',1)[1]]) File "D:\tmp\Yaki\yaki\userlibs\yaki\Page.py", line 62, in init raise TypeError, "Invalid page file format."TypeError: Invalid page file format.

Any chance that Windows is a supported platform ?

rcarmo commented 12 years ago

Ah, that's now probably due to line break handling, which is different on each OS.

Sadly, I have no real way to debug or maintain a Windows version. I heard from someone porting this to IronPython and .NET a while back, but the only way I ever really tested Yaki on Windows during the early years was under Cygwin (which gives you a UNIX-like runtime environment and corresponding Python).

On Apr 12, 2012, at 13:34 , Michel Daviot wrote:

I converted to an int in Indexer ... now I get another error :

File "D:\tmp\Yaki\yaki\snakeserver\webapp.py", line 619, in run_snakelet snake.serve(req, resp) # <--- actual call to snakelet File "D:\tmp\Yaki\yaki\userlibs\yaki\Engine.py", line 294, in serve page = self.getPage(request, response) File "D:\tmp\Yaki\yaki\userlibs\yaki\Engine.py", line 512, in getPage page = ac.store.getRevision(path) File "D:\tmp\Yaki\yaki\userlibs\yaki\Store.py", line 121, in getRevision p = Page(buffer,BASE_TYPES[base.split('.',1)[1]]) File "D:\tmp\Yaki\yaki\userlibs\yaki\Page.py", line 62, in init raise TypeError, "Invalid page file format."TypeError: Invalid page file format.

Any chance that Windows is a supported platform ?


Reply to this email directly or view it on GitHub: https://github.com/rcarmo/Yaki/issues/6#issuecomment-5089921