Corne Dickens
unread,Jun 16, 2011, 4:55:53 AM6/16/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to web2py-users
web2py Version 1.96.4 under sl4a (android / python 2.6.2) does not
start due to a few errors.
The first one is in dal.py
It seems that there was already half fixed, the problem is in
path_encoding = sys.getfilesystemencoding() or
locale.getdefaultlocale()[1]
the result is empty here.
There is one place in the code where this was fixed already (with an
additional or 'utf8'), this fix should also go to the other places
where the same structure is used.
PATCH
diff -U 3 -H -d -r -N -- web2py/gluon/dal.py web2py_droid/gluon/dal.py
--- web2py/gluon/dal.py 2011-06-07 22:07:48.000000000 +0200
+++ web2py_droid/gluon/dal.py 2011-06-16 10:14:49.677764405 +0200
@@ -1487,7 +1487,7 @@
self.folder = folder
self.db_codec = db_codec
self.find_or_make_work_folder()
- path_encoding = sys.getfilesystemencoding() or
locale.getdefaultlocale()[1]
+ path_encoding = sys.getfilesystemencoding() or
locale.getdefaultlocale()[1] or 'utf8'
if uri.startswith('sqlite:memory'):
dbpath = ':memory:'
else:
@@ -1523,7 +1523,7 @@
self.folder = folder
self.db_codec = db_codec
self.find_or_make_work_folder()
- path_encoding = sys.getfilesystemencoding() or
locale.getdefaultlocale()[1]
+ path_encoding = sys.getfilesystemencoding() or
locale.getdefaultlocale()[1] or 'utf8'
if uri.startswith('sqlite:memory'):
dbpath = ':memory:'
else:
The second thing is in cache.py
os.unlink(self.shelve_name) gives an exception because the file is not
found.
In the code there is an if statement which is True when the file does
not exist.
In the if there is an open for reading, which failes in case the file
does not exist, deleting the file will in that case also fail..
PATCH
diff -U 3 -H -d -r -N -- web2py_unicode/gluon/cache.py web2py_droid/
gluon/cache.py
--- web2py_unicode/gluon/cache.py 2011-06-07 22:07:48.000000000 +0200
+++ web2py_droid/gluon/cache.py 2011-06-16 10:35:38.625610104 +0200
@@ -257,7 +257,10 @@
except:
logger.error('corrupted file %s, deleting it!' \
% self.shelve_name)
- os.unlink(self.shelve_name)
+ try:
+ os.unlink(self.shelve_name)
+ except:
+ pass # open could fail in case the fail doensn't exist.. Unlink
will fail than also...
if locker_locked:
portalocker.unlock(locker)
if locker: