Yep, this is a bug. In backend_ps in the the set_linedashes
>> function on line 103, replace the line if seq: with if seq is
>> not None and len(seq): My guess is you are using numarray, and
>> if memory serves numarray but not Numeric fails on using an
>> array as a boolean, which is what backend ps is doing here.
>>
> Yes, I am using numarray. I made the change to line 103
> and now line 102 is reporting a similar error.
Ignore my last post - the solution I posted was as buggy as before. I
think I finally nailed this down. Basically, we are comparing seq1
and seq2, either are possibly None, or general sequences, or arrays.
I wrote a little function
def seq_allequal(seq1, seq2):
"""
seq1 and seq2 are either None or sequences or numerix arrays
Return True if both are None or both are seqs with identical
elements
"""
if seq1 is None:
return seq2 is None
if seq2 is None:
return False
#ok, neither are None:, assuming iterable
if len(seq1) != len(seq2): return False
return alltrue(equal(seq1, seq2))
You should import alltrue and equal from the numerix module at the top
of backend_ps, add this function to backend_ps and then replace
set_linedash with
def set_linedash(self, offset, seq):
if self.linedash is not None:
oldo, oldseq = self.linedash
if seq_allequal(seq, oldseq): return
if seq is not None and len(seq):
s="[%s] %d setdash\n"%(_nums_to_str(*seq), offset)
self._pswriter.write(s)
else:
self._pswriter.write(" 0 setdash\n")
self.linedash = (offset,seq)
I think this is finally coherent. At least it passes my tests now...
JDH