Error with Pisa? P3?

675 views
Skip to first unread message

Tom Brander

unread,
Feb 26, 2014, 3:59:59 PM2/26/14
to mezzani...@googlegroups.com
Went to create a pdf invoice and got this error:
I am using Python #.3 if that makes a diff??
Does not give me much to go on the "view" invoice is working fine...

Traceback:
File "/home/tom/myvenv3/lib/python3.3/site-packages/django/core/handlers/base.py" in get_response
  107.                     response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/home/tom/myvenv3/lib/python3.3/site-packages/mezzanine/pages/middleware.py" in process_view
  78.             response = view_func(request, *view_args, **view_kwargs)
File "/home/tom/myvenv3/lib/python3.3/site-packages/cartridge/shop/views.py" in invoice
  358.         import ho.pisa
File "/home/tom/myvenv3/lib/python3.3/site-packages/ho/pisa/__init__.py" in <module>
  26. from sx.pisa3.pisa import *

Exception Type: SyntaxError at /shop/invoice/1/
Exception Value: invalid syntax (__init__.py, line 43)

Danny

unread,
Feb 26, 2014, 4:43:49 PM2/26/14
to mezzani...@googlegroups.com
On 27/02/2014 7:29 AM, Tom Brander wrote:
> Went to create a pdf invoice and got this error:
> I am using Python #.3 if that makes a diff??
> Does not give me much to go on the "view" invoice is working fine...

Can you do a pip list for us?

Do you have pisa and reportlab both installed? What versions?


>
> Traceback:
> File
> "/home/tom/myvenv3/lib/python3.3/site-packages/django/core/handlers/base.py"
> in get_response
> 107. response = middleware_method(request,
> callback, callback_args, callback_kwargs)
> File
> "/home/tom/myvenv3/lib/python3.3/site-packages/mezzanine/pages/middleware.py"
> in process_view
> 78. response = view_func(request, *view_args, **view_kwargs)
> File
> "/home/tom/myvenv3/lib/python3.3/site-packages/cartridge/shop/views.py"
> in invoice
> 358. import ho.pisa
> File "/home/tom/myvenv3/lib/python3.3/site-packages/ho/pisa/__init__.py"
> in <module>
> 26. from sx.pisa3.pisa import *
>
> Exception Type: SyntaxError at /shop/invoice/1/
> Exception Value: invalid syntax (__init__.py, line 43)
>
> --
> You received this message because you are subscribed to the Google
> Groups "Mezzanine Users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to mezzanine-use...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Email: mol...@gmail.com

Tom Brander

unread,
Feb 26, 2014, 6:22:13 PM2/26/14
to mezzani...@googlegroups.com, mol...@gmail.com
Hmm did not have reportlab, so I installed it but no change, here is the pip list
(myvenv3) tom@tom-sam:~/whiteplume$ pip list
bleach (1.4)
Cartridge (0.9.2)
Django (1.6.2)
filebrowser-safe (0.3.2)
future (0.9.0)
grappelli-safe (0.3.6)
html5lib (0.999)
Mezzanine (3.0.9)
oauthlib (0.6.1)
Pillow (2.3.0)
pip (1.5.4)
pisa (3.0.33)
pytz (2013.9)
reportlab (3.0)
requests (2.2.1)
requests-oauthlib (0.4.0)
setuptools (2.2)
six (1.5.2)
tzlocal (1.0)

Danny

unread,
Feb 26, 2014, 6:42:18 PM2/26/14
to Tom Brander, mezzani...@googlegroups.com
The error is coming from sx/pisa3/__init__.py, line 43 which says:

{{{
if not REPORTLAB22:
raise ImportError, "Reportlab Toolkit Version 2.2 or higher needed"
}}}

Now, obviously you do have reportlab of a version higher than 2.2 but
there was a bug mentioned on the cartridge issues a few weeks ago which
seemed to indicate that reportlab 3.0 isn't reporting its version
correctly as higher than 2.2.

See https://github.com/stephenmcd/cartridge/issues/174#issuecomment-35755887

It seems like it's a known bug in pisa.

Hope this helps.

Seeya. Danny.
> > an email to mezzanine-use...@googlegroups.com <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
>
>
>
> --
> Email: mol...@gmail.com <javascript:>
>



--
Email: mol...@gmail.com

Tom Brander

unread,
Feb 27, 2014, 9:05:02 AM2/27/14
to mezzani...@googlegroups.com, Tom Brander, mol...@gmail.com
Thanks so much!! now I know where to look.. 

BTW Shouldn't both reportlab and pillow be in the requirements txt file??  They were the only two I needed to download separately..

Tom Brander

unread,
Feb 27, 2014, 7:15:32 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander, mol...@gmail.com
Tried to used the fix suggested  but still getting the same error (FWIW I never did get the message version 2.2 or higher needed),, so I'm suspecting pisa is a no go with Python 3 and that it is simply failing??



Posted question in the xhtml2pdf group, linked below:


Error:
Exception Value:
invalid syntax (__init__.py, line 43)
Exception Location:/home/tom/myvenv3/lib/python3.3/site-packages/ho/pisa/__init__.py in <module>, line 26
Python Executable:/home/tom/myvenv3/bin/python
Python Version:3.3.2

Danny

unread,
Feb 27, 2014, 7:17:12 PM2/27/14
to Tom Brander, mezzani...@googlegroups.com
Best option for now is to downgrade reportlab to 2.7 (I did that on my site this morning, after this discussion!)

Just add reportlab==2.7 to your requirements/project.txt and do a pip install -U -r requirements/project.txt

Seeya. Danny.

Stephen McDonald

unread,
Feb 27, 2014, 7:19:32 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
Thanks Danny - I'm not really across the issue, do you think we need to specify that exact reportlab version in Cartridge's setup.py?


To unsubscribe from this group and stop receiving emails from it, send an email to mezzanine-use...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



--
Stephen McDonald
http://jupo.org

Danny

unread,
Feb 27, 2014, 7:23:59 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
I'd say so, Stephen, at least until cartridge can be updated to use xhtml2pdf instead of pisa (which seems to be an abandoned project).

At the moment, there's no dependency on reportlab in cartridge (only pisa), but because pisa doesn't have reportlab in its own dependency list, it couldn't hurt specifying the versions that cartridge needs.

I'll create a pull request, if you like?

Seeya. Danny.

Stephen McDonald

unread,
Feb 27, 2014, 7:25:37 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
Thanks a lot that'd be great!

Danny

unread,
Feb 27, 2014, 7:33:12 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
Tom's pointed out in a private email that he's working with Python 3, and reportlab 2.7 won't work on Python 3.

I'm still using python 2.7, so using an older reportlab is fine for me.

Should I still go ahead with the change to cartridge's setup.py (adding reportlab==2.7 as a dependency) or should we look at trying and solving the larger issue?

Seeya. Danny.

Stephen McDonald

unread,
Feb 27, 2014, 7:35:53 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
Yep sounds good

Danny

unread,
Feb 27, 2014, 7:51:08 PM2/27/14
to mezzani...@googlegroups.com, Tom Brander
Ok, so I've created a pull request adding reportlab 2.7 as a dependency for cartridge:
https://github.com/stephenmcd/cartridge/pull/181

And also opened an issue so we can potentially work on upgrading to use xhtml2pdf in future:
https://github.com/stephenmcd/cartridge/issues/180

Hope this helps.

Seeya. Danny.
PS. Tom, feel free to work on that issue, if you want!

Tom Brander

unread,
Feb 28, 2014, 7:43:45 AM2/28/14
to mezzani...@googlegroups.com
It is probably beyond my level, but I'll try to take a look at the replacement xhtml2pdf....

Tom Brander

unread,
Mar 1, 2014, 12:57:08 PM3/1/14
to mezzani...@googlegroups.com
Took a look, and xhtml2pdf is not P3 capable either

Ken Bolton

unread,
Mar 1, 2014, 1:08:47 PM3/1/14
to mezzanine-users
Python 3 is a Really Good Idea. Unfortunately, as you have discovered, many modules do not yet support Python 3. Stick with 2.7 to save yourself head/heart-ache.

Tom Brander

unread,
Mar 1, 2014, 2:40:46 PM3/1/14
to mezzani...@googlegroups.com
I get it,, so far I have been pleasantly surprised at my 1st foray into P3.. This thing will probably have to deploy on P2 though
Reply all
Reply to author
Forward
0 new messages