I haven't seen the session lock yet but there are many unlocking
errors (no locking errors). I did this:
def lock(file, flags):
file.seek(0)
mode = {LOCK_NB:LK_NBLCK, LOCK_SH:LK_NBLCK, LOCK_EX:LK_LOCK}
[flags]
try:
msvcrt.locking(file.fileno(), mode,
os.path.getsize(file.name))
except IOError:
logger.warn('Locking error')
def unlock(file):
file.seek(0)
mode = LK_UNLCK
try:
msvcrt.locking(file.fileno(), mode,
os.path.getsize(file.name))
except IOError:
logger.warn('Unlocking error')
On Nov 27, 4:19 pm, mdipierro <[email protected]> wrote:
> Here there is a thread on the topic:
>
> http://code.activestate.com/lists/python-list/236518/
>
> although it does not help much.
>
> For debugging purporses.... if you replace
>
> msvcrt.locking(file.fileno(), mode, os.path.getsize(file.name))
>
> with
>
> try: msvcrt.locking(file.fileno(), mode,
> os.path.getsize(file.name))
> except IOError: pass
>
> do you end up with a session permanently locked or does it fix the
> problem?
>
> Massimo
>
> On Nov 27, 3:34 pm, "mr.freeze" <[email protected]> wrote:
>
> > I get this occasionally on Windows 7 and Python 2.5:
>
> > Traceback (most recent call last):
> > File "C:\web2py\gluon\restricted.py", line 188, in restricted
> > exec ccode in environment
> > File "C:/web2py/applications/test/models/db.py", line 66, in
> > <module>
> > Field('converter')
> > File "C:\web2py\gluon\sql.py", line 1380, in define_table
> > t._create(migrate=migrate, fake_migrate=fake_migrate)
> > File "C:\web2py\gluon\sql.py", line 1856, in _create
> > portalocker.unlock(tfile)
> > File "C:\web2py\gluon\portalocker.py", line 78, in unlock
> > msvcrt.locking(file.fileno(), mode, os.path.getsize(file.name))
> > IOError: [Errno 13] Permission denied
>
> > I reload the page and it goes away for a while.
>
>