[reportlab-users] Python 3.x progress

Peter Cock p.j.a.cock at googlemail.com
Thu Jan 9 09:48:46 EST 2014


On Thu, Jan 9, 2014 at 2:22 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:

>>

>> can you abstract the problem to something simple that I can test elsewhere?

>> Andy & Ricardo both have macs that could be used. The _rl_accel.c code was

>> changed significantly to make things work with both 3.3 & 2.7 so I would

>> like to get at any seg faults in there asap.

>

> Try https://gist.github.com/peterjc/8334631 which extracts the

> failing Biopython unit test as a short script. I'm working on

> further simplifying it - currently in addition to ReportLab it

> requires Biopython (using Biopython 1.63 should be fine).


Gist updated to be self contained (by bundling a few classes
and functions from Biopython), same errors:

[Mac OS X] $ python2.7 reportlab_ps_test.py
Segmentation fault: 11

Recall this is using the Apple provided Python 2.7,

$ which python2.7
/usr/bin/python2.7

$ python2.7 --version
Python 2.7.5


[Mac OS X] $ python3.3 reportlab_ps_test.py
Traceback (most recent call last):
File "reportlab_ps_test.py", line 544, in <module>
simple_organism("organism.eps", "ps")
File "reportlab_ps_test.py", line 542, in simple_organism
test_organism.draw(filename, "Test organism")
File "reportlab_ps_test.py", line 184, in draw
return _write(cur_drawing, output_file, self.output_format)
File "reportlab_ps_test.py", line 70, in _write
return drawmethod.drawToFile(drawing, output_file)
File "/Users/peterjc/lib/python3.3/site-packages/reportlab/graphics/renderPS.py",
line 879, in drawToFile
c.save(fn)
File "/Users/peterjc/lib/python3.3/site-packages/reportlab/graphics/renderPS.py",
line 155, in save
file.write(self._sep.join(self.code))
TypeError: 'str' does not support the buffer interface


>

> I've not yet tried this under Linux, but could do so as well...


On my 64bit Linux desktop the segmentation fault does not
happen - the unicode/string issue under Python 3 is the same.

[linux] $ python2.7 reportlab_ps_test.py
(Good news - produces simple ugly postscript file)

[linux] $ python3.3 reportlab_ps_test.py
Traceback (most recent call last):
File "reportlab_ps_test.py", line 544, in <module>
simple_organism("organism.eps", "ps")
File "reportlab_ps_test.py", line 542, in simple_organism
test_organism.draw(filename, "Test organism")
File "reportlab_ps_test.py", line 184, in draw
return _write(cur_drawing, output_file, self.output_format)
File "reportlab_ps_test.py", line 70, in _write
return drawmethod.drawToFile(drawing, output_file)
File "/home/peterjc/lib/python3.3/site-packages/reportlab/graphics/renderPS.py",
line 879, in drawToFile
c.save(fn)
File "/home/peterjc/lib/python3.3/site-packages/reportlab/graphics/renderPS.py",
line 155, in save
file.write(self._sep.join(self.code))
TypeError: 'str' does not support the buffer interface

Does that help?

Peter


More information about the reportlab-users mailing list