| Issue 154: | If pdf_stylesheet is missing the building fails: TypeError: unsupported operand type(s) for -: 'int' and 'list' | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Sign in to add a comment
|
When the pdfbuilder is enabled, but not stylesheet is not defined
(pdf_stylesheet is not defined in Sphinx's conf.py), building fails with an
error:
Exception occurred:
File "/usr/lib/python2.6/site-packages/reportlab/platypus/paragraph.py",
line 910, in drawPara
op(leftIndent-bp,
TypeError: unsupported operand type(s) for -: 'int' and 'list'
In my case, the values that were tried to sum together, were:
- int: 0 (leftIndent)
- list [6, 0, 0, 10] (bp)
If pdf_stylesheet is defined (in conf.py) even with empty value, the build
success. Therefore, the error message could be improved or default
functionality improved?
Versions used:
- Python 2.6
- Sphinx 1.0dev
- rst2pdf 0.12dev
|
||||||||||
,
Aug 18, 2009
The extension is not supposed to work with sphinx 1.0dev, by advice of the sphinx developers, because that version's API can change. So if it works there, it's just a coincidence. I will try to reproduce this with current 0.6.x now.
Owner: roberto.alsina
|
|||||||||||
,
Aug 18, 2009
Sure thing - I'll report only the errors occurring with 0.6.x from now on. And just verified by myself as well: the problem exists with Sphinx 0.6.2+ as well. |
|||||||||||
,
Aug 18, 2009
I can't reproduce (dummy sphinx project attached) :-( |
|||||||||||
,
Aug 18, 2009
Hmm. It fail for me (even with the dummy project):
[juha@midget:~/tmp/rst2pdf/issue-154]make pdf
sphinx-build -b pdf -d _build/doctrees . _build/pdf
Making output directory...
Running Sphinx v0.6.2+
/usr/lib/python2.6/site-packages/reportlab/pdfbase/pdfutils.py:44: SyntaxWarning:
assertion is always true, perhaps remove parentheses?
assert(len(raw) == imgwidth * imgheight, "Wrong amount of data for image")
/usr/lib/python2.6/site-packages/reportlab/pdfgen/canvas.py:17: DeprecationWarning:
the md5 module is deprecated; use hashlib instead
import md5
/usr/lib/python2.6/site-packages/reportlab/pdfbase/pdfdoc.py:1899: SyntaxWarning:
assertion is always true, perhaps remove parentheses?
assert(len(raw) == self.width*self.height, "Wrong amount of data for image")
loading pickled environment... not found
building [pdf]: targets for 1 source files that are out of date
updating environment: 1 added, 0 changed, 0 removed
reading sources... [100%] index
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
index
Exception occurred:
File "/usr/lib/python2.6/site-packages/reportlab/platypus/paragraph.py", line 910,
in drawPara
op(leftIndent-bp,
TypeError: unsupported operand type(s) for -: 'int' and 'list'
The full traceback has been saved in /tmp/sphinx-err-I3jkIw.log, if you want to
report the issue to the author.
Please also report this if it was a user error, so that a better error message can be
provided next time.
Send reports to sphinx-dev@googlegroups.com. Thanks!
make: *** [pdf] Error 1
----
I'd say the problem is in default 'sphinx.json', in borderPadding:
1 {"pageSetup": {
2 "firstTemplate": "coverPage",
3 "margin-top": "8mm",
4 "margin-bottom": "8mm",
5 "margin-left": "12mm",
6 "margin-right": "12mm"
7 },
8 "styles": [
9 ["heading", {
10 "backColor": "#F2F2F2",
11 "textColor": "#20435C",
12 "borderWidth": 0.3,
13 "borderColor": "#CCCCCC",
14 "leading": 10,
15 "spaceBefore": 16,
16 "borderPadding": [6,0,0,10],
When compared to stylesheet generated with rst2pdf, the borderPadding seem to be
integer, not a list (see the description of the issue)
|
|||||||||||
,
Aug 18, 2009
Ok, I think we are close to the issue here. What's your reportlab version? The "padding is a list" thing is new, maybe you are using 2.1? If that's the case, I will fix it anyway because I want to be 2.1-compatible if possible. |
|||||||||||
,
Aug 18, 2009
Yes, the reportlab version is: 2.1 Glad the issue helped (both me and rst2pdf) |
|||||||||||
,
Aug 18, 2009
Ok, I'll start work on this right away. In any case, just as an advice: Get RL 2.3: it has a ton of bugs fixed.
Status: Started
|
|||||||||||
,
Aug 18, 2009
Fixed (I think) in r827 Please verify. |
|||||||||||
,
Aug 18, 2009
(No comment was entered for this change.)
Status: Fixed
|
|||||||||||
,
Aug 18, 2009
Confirmed - fixes the issue. |
|||||||||||
,
Aug 18, 2009
(No comment was entered for this change.)
Status: Verified
|
|||||||||||
|
|
|||||||||||