I just got an exception from a script that is regularly run via cron.
The script is supposed to choose a random signature file, which it
does perfectly well. Just every now an then I receive the following
error. I'd be glad if anyone could explain what's happening. It's
Python 2.2, the script is run every 20 seconds.
XXX lineno: 454, opcode: 0
Traceback (most recent call last):
File "/home/cg/bin/sigrotate.py", line 5, in ?
sigs = glob.glob("/home/cg/.sig[0-9]*")
File "/usr/local/python-2.2/lib/python2.2/glob.py", line 37, in glob
sublist = glob1(dirname, basename)
File "/usr/local/python-2.2/lib/python2.2/glob.py", line 50, in
glob1
return fnmatch.filter(names,pattern)
File "/usr/local/python-2.2/lib/python2.2/fnmatch.py", line 47, in
filter
_cache[pat] = re.compile(res)
File "/usr/local/python-2.2/lib/python2.2/sre.py", line 178, in
compile
return _compile(pattern, flags)
File "/usr/local/python-2.2/lib/python2.2/sre.py", line 226, in
_compile
p = sre_compile.compile(pattern, flags)
File "/usr/local/python-2.2/lib/python2.2/sre_compile.py", line 430,
in compile
p = sre_parse.parse(p, flags)
File "/usr/local/python-2.2/lib/python2.2/sre_parse.py", line 623,
in parse
p = _parse_sub(source, pattern, 0)
File "/usr/local/python-2.2/lib/python2.2/sre_parse.py", line 318,
in _parse_sub
if source.match("|"):
File "/usr/local/python-2.2/lib/python2.2/sre_parse.py", line 454,
in _parse
min, max = 0, MAXREPEAT
SystemError: unknown opcode
And this is the script:
[cg@cg cg]$ cat bin/sigrotate.py
#! /usr/bin/python -S
import glob, whrandom, os
sigs = glob.glob("/home/cg/.sig[0-9]*")
sig = whrandom.choice(sigs)
open("/home/cg/.sigtemp", "w").write(open(sig, "r").read())
os.rename("/home/cg/.sigtemp", "/home/cg/.signature")
Regards
Carsten.
--
'In iteger arithetric divsion is no the oposite of multiplication.'
-- scenes from comp.lang.python
> I just got an exception from a script that is regularly run via cron.
> The script is supposed to choose a random signature file, which it
> does perfectly well. Just every now an then I receive the following
> error. I'd be glad if anyone could explain what's happening.
That's hard to explain; this is not supposed to happen.
One theory is that there is a hardware problem with your computer's
memory (or your hard disk), making it present the byte code
differently in memory than it is on disk. I've also seen file system
drivers stomp on the buffers they read from disk (Linux reiserfs in
particular).
It could be a bug in Python also, but that is unlikely :-)
Regards,
Martin