Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

WindowsError in time.sleep !?!??!!

0 views
Skip to first unread message

Eric Brunel

unread,
Jul 1, 2002, 7:19:50 AM7/1/02
to
Hi all,

We encountered quite a strange problem in an application running on Win2k:
when doing a time.sleep(0.1), we occasionally get a traceback:

WindowsError: [Errno 5] Access is denied

I haven't been able to systematically reproduce the problem. The strange
thing is that when it occurs, there's another time.sleep(1) a few lines
above, and this one always works.

Does anybody have an explanation and/or a workaround for this problem? We
may of course delete this statement, but it doesn't sound quite safe: we
have many time.sleep in our code, and if we don't understand why this is
happening, it may break another one later...

Python version is 2.1 and we use multithreading, although not heavily.

TIA
--
- Eric Brunel <eric....@pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com

Eric Brunel

unread,
Jul 1, 2002, 7:53:21 AM7/1/02
to
Eric Brunel wrote:
[snip]

> Does anybody have an explanation and/or a workaround for this problem? We
> may of course delete this statement, but it doesn't sound quite safe: we
> have many time.sleep in our code, and if we don't understand why this is
> happening, it may break another one later...

We tried to delete the statement, and it actually crashes later, but on an
even stranger line: it's an if statement, just comparing a plain variable
to an empty string (something like "if v == '':"). And we get the same
error: WindowsError, access denied...

Can somebody help? TIA...

Thomas Heller

unread,
Jul 1, 2002, 6:04:18 AM7/1/02
to
"Eric Brunel" <eric....@pragmadev.com> wrote in message news:afp8em$r0p$1...@wanadoo.fr...

> Eric Brunel wrote:
> [snip]
> > Does anybody have an explanation and/or a workaround for this problem? We
> > may of course delete this statement, but it doesn't sound quite safe: we
> > have many time.sleep in our code, and if we don't understand why this is
> > happening, it may break another one later...
>
> We tried to delete the statement, and it actually crashes later, but on an
> even stranger line: it's an if statement, just comparing a plain variable
> to an empty string (something like "if v == '':"). And we get the same
> error: WindowsError, access denied...
>
This sounds like some C code (in an extension?)is setting
an error, and failes to check for NULL afterwards.
If you insert something like this before your "if v == '':" line
try: 1/0
except: pass
and the problem goes away, it seems to be the cause for it.

Thomas

Eric Brunel

unread,
Jul 1, 2002, 8:58:35 AM7/1/02
to
Thomas Heller wrote:
> This sounds like some C code (in an extension?)is setting
> an error, and failes to check for NULL afterwards.
> If you insert something like this before your "if v == '':" line
> try: 1/0
> except: pass
> and the problem goes away, it seems to be the cause for it.

This was it! Thank you very much: we'd never figured out this one by
ourselves...

0 new messages