[Tutor] Portalocker

lonetwin lonetwin@yahoo.com
Fri Jul 18 02:30:02 2003


Hi there,
    Could you possibly post a URL for portalocker ??
At first glance I can hazard a guess, since I too have done such mistakes when 
playing in the interpreter.

> >>> import portalocker
> >>> file=open("C:\My Documents\log.txt", "r+")
> >>> portalocker.lock(file, portalocker.LOCK_EX)
>
> Traceback (most recent call last):
>   File "<pyshell#13>", line 1, in ?
>     portalocker.lock(file, portalocker.LOCK_EX)
> AttributeError: 'module' object has no attribute 'lock'

    The error message is pretty clear. You seem to be calling a non-existant 
method in the module 'portalocker' called 'lock' ('module' object has no 
attribute 'lock')

    Normally, for me, something like this happens in the interpreter when I 
stupidly try to use a method that belongs to a class with the same name is 
the module. What I mean is, look at the portalocker module and see if there 
is a class called 'portalocker' which you have to instantiate before calling 
the 'lock' method on the instance.

Peace
Steve

-- 
It is easier to resist at the beginning than at the end.
		-- Leonardo da Vinci