[google-appengine] Re: Using ReportLab with ZipImport

2009-04-30 Thread Ruud Helderman

Hi Arun,
Sorry for my earlier post arriving 'a day after the fair', it got
delayed by moderator policy (check its timestamp).

This is a generic problem - not something specific to either ReportLab
or Pisa. Zipping a library is a matter of choice during deployment -
why should that affect the source code of each module depending on the
library?

In Python documentation, I noticed 2 ways to globally expand sys.path,
without having to adjust individual .py files:
1. PYTHONPATH environment variable
2. .pth files

However, I doubt if either one is available to GAE application
developers. If not, then adjusting the Pisa sources is your only
option, sorry.

IMHO, zipimporter is nice, but immature - I would rather have a more
transparent approach. An API layer on top of the filesystem that hides
the difference between ZIP files and 'real' folders (much like
'compressed folders' in Windows), not only for import statements but
for regular file access as well.


On Apr 28, 6:31 am, Arun Shanker Prasad arunshankerpra...@gmail.com
wrote:
 Hi Ruud,

 Thanks for the patch, I mentioned your patch comment #5. It is great
 and works fine when used with the ReportLab package alone.

 My problem is that I use ReportLab as a requirement for the Pisa
 package,
 (http://www.xhtml2pdf.com/doc/pisa-en.html,http://pypi.python.org/pypi/pisa/)

 Since reportlab is called from inside these packages, they are not
 able to find the reportlab package. Do you know of any work around for
 this?

 Thanks,
 Arun Shanker Prasad.

 On Apr 25, 7:07 pm, Ruud Helderman liping...@hotmail.com wrote:

  I patched the ReportLab library, works fine for me.

  For a simple demo and full source code, look 
  here:http://ruudhelderman.appspot.com/testpdf

  I added a comment with detailed explanation to issue 
  1085:http://code.google.com/p/googleappengine/issues/detail?id=1085
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-30 Thread Arun Shanker Prasad

Hi Ruud,

Thanks for the reply. I did notice the timestamp now :)

I think using the PYTHONPATH and setting .pth is a no go in GAE, as
far as I know..
I was afraid of that, might have to get started in the Pisa code..

Thanks again for the solution, I saw some people using ReportLab in
GAE, will help them a lot.

Thanks,
Arun Shanker Prasad.

On Apr 30, 11:16 pm, Ruud Helderman liping...@hotmail.com wrote:
 Hi Arun,
 Sorry for my earlier post arriving 'a day after the fair', it got
 delayed by moderator policy (check its timestamp).

 This is a generic problem - not something specific to either ReportLab
 or Pisa. Zipping a library is a matter of choice during deployment -
 why should that affect the source code of each module depending on the
 library?

 In Python documentation, I noticed 2 ways to globally expand sys.path,
 without having to adjust individual .py files:
 1. PYTHONPATH environment variable
 2. .pth files

 However, I doubt if either one is available to GAE application
 developers. If not, then adjusting the Pisa sources is your only
 option, sorry.

 IMHO, zipimporter is nice, but immature - I would rather have a more
 transparent approach. An API layer on top of the filesystem that hides
 the difference between ZIP files and 'real' folders (much like
 'compressed folders' in Windows), not only for import statements but
 for regular file access as well.

 On Apr 28, 6:31 am, Arun Shanker Prasad arunshankerpra...@gmail.com
 wrote:



  Hi Ruud,

  Thanks for the patch, I mentioned your patch comment #5. It is great
  and works fine when used with the ReportLab package alone.

  My problem is that I use ReportLab as a requirement for the Pisa
  package,
  (http://www.xhtml2pdf.com/doc/pisa-en.html,http://pypi.python.org/pypi...)

  Since reportlab is called from inside these packages, they are not
  able to find the reportlab package. Do you know of any work around for
  this?

  Thanks,
  Arun Shanker Prasad.

  On Apr 25, 7:07 pm, Ruud Helderman liping...@hotmail.com wrote:

   I patched the ReportLab library, works fine for me.

   For a simple demo and full source code, look 
   here:http://ruudhelderman.appspot.com/testpdf

   I added a comment with detailed explanation to issue 
   1085:http://code.google.com/p/googleappengine/issues/detail?id=1085
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-27 Thread Arun Shanker Prasad

Hi,

Update: Thanks to the solution from liping... (Name not written in
full), I was able to solve the problem with ZipImport and ReportLab.
You can find more details about it from,

Sample hosted in GAE, also contains the source :-
http://ruudhelderman.appspot.com/testpdf
Explanation in issue tracker :-
http://code.google.com/p/googleappengine/issues/detail?id=1085

Thanks,
Arun Shanker Prasad.

On Apr 8, 9:21 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
wrote:
 Thank you Jeff for the help.

 I was actually using ReportLab along with Pisa, I had posted a similar
 question on their forum as the demo for this (http://www.xhtml2pdf.com/
 demo) seems to be hosted in Google App Engine.

 I will try the ReportLab developers also and hope they have a
 solution.

 Meanwhile can I go ahead and upload the libraries to Google App Engine
 and convert it to Zip and reduce the number of files later?

 Thanks,
 Arun Shanker Prasad.

 On Apr 8, 2:09 am, Jeff S j...@google.com wrote:

  Hello Arun Shanker Prasad,

  I'm not familiar with ReportLab, but from reading a tiny bit of their
  documentation it seems like they are interested in making their
  software usable from within App Engine.

  (They mention App Engine on this 
  pagehttp://www.reportlab.org/downloads.html#reportlab
  )

  Have you tried contacting the ReportLab developers? It looks this the
  issue is related to secure runtime restrictions and are triggered by
  the module loader during the import. It would be great if this library
  worked on App Engine, so I'm hoping that we collectively will figure
  this out. I'm not sure if I'll have time to dig in to this issue, as
  much as I'd like to.

  Thank you,

  Jeff

  On Apr 6, 10:23 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
  wrote:

   Hi,

   Anyone got any work-around for my situation? I am stuck at this
   point...

   Thanks,
   Arun Shanker Prasad.

   On Apr 6, 5:12 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
   wrote:

Hi,

I have a requirement to generate dynamic PDFs from HTML source. I
included the Pisa, html5lib and the reportlab packages for this.
Everything works fine in the local environment as long I keep all the
packages in the initial source ie I do not zip it.

Keeping the whole ReportLab package (204 files) might take me way
close to the allowed file limit. I tried to convert the ReportLab
package into a zip and use zipimport to use it. This causes the
following error,

AttributeError: 'HardenedModulesHook' object has no attribute '_files'

My source where the imports are called,
import sys
sys.path.insert(0, 'ho.zip')
sys.path.insert(0, 'html5lib.zip')
sys.path.insert(0, 'sx.zip')
sys.path.insert(0, 'reportlab.zip')
import ho.pisa as pisa

Googled a bit for the solution found another mention of this in issue
tracker,http://code.google.com/p/googleappengine/issues/detail?id=1085.

Can anyone help me get around this problem? I have seen many use
reportlab in Google App Engine how do you guys get around this issue??

Any help will be greatly appreciated.

Thanks,
Arun Shanker Prasad.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-27 Thread Arun Shanker Prasad

Hi,

Spoke too soon. Although this works in the case of importing ReportLab
alone, when used along with Pisa this will fail as the pisa modules
look for the ReportLab package as well and they do not find them from
the zip file.

May need to modify all the pisa packages as well to include,
sys.path.insert(0, 'reportlab.zip')

Thanks,
Arun Shanker Prasad.

On Apr 27, 12:09 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
wrote:
 Hi,

 Update: Thanks to the solution from liping... (Name not written in
 full), I was able to solve the problem with ZipImport andReportLab.
 You can find more details about it from,

 Sample hosted in GAE, also contains the source 
 :-http://ruudhelderman.appspot.com/testpdf
 Explanation in issue tracker :-    
 http://code.google.com/p/googleappengine/issues/detail?id=1085

 Thanks,
 Arun Shanker Prasad.

 On Apr 8, 9:21 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
 wrote:

  Thank you Jeff for the help.

  I was actually usingReportLabalong with Pisa, I had posted a similar
  question on their forum as the demo for this (http://www.xhtml2pdf.com/
  demo) seems to be hosted in Google App Engine.

  I will try theReportLabdevelopers also and hope they have a
  solution.

  Meanwhile can I go ahead and upload the libraries to Google App Engine
  and convert it to Zip and reduce the number of files later?

  Thanks,
  Arun Shanker Prasad.

  On Apr 8, 2:09 am, Jeff S j...@google.com wrote:

   Hello Arun Shanker Prasad,

   I'm not familiar withReportLab, but from reading a tiny bit of their
   documentation it seems like they are interested in making their
   software usable from within App Engine.

   (They mention App Engine on this 
   pagehttp://www.reportlab.org/downloads.html#reportlab
   )

   Have you tried contacting theReportLabdevelopers? It looks this the
   issue is related to secure runtime restrictions and are triggered by
   the module loader during the import. It would be great if this library
   worked on App Engine, so I'm hoping that we collectively will figure
   this out. I'm not sure if I'll have time to dig in to this issue, as
   much as I'd like to.

   Thank you,

   Jeff

   On Apr 6, 10:23 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
   wrote:

Hi,

Anyone got any work-around for my situation? I am stuck at this
point...

Thanks,
Arun Shanker Prasad.

On Apr 6, 5:12 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
wrote:

 Hi,

 I have a requirement to generate dynamic PDFs from HTML source. I
 included the Pisa, html5lib and thereportlabpackages for this.
 Everything works fine in the local environment as long I keep all the
 packages in the initial source ie I do not zip it.

 Keeping the wholeReportLabpackage (204 files) might take me way
 close to the allowed file limit. I tried to convert theReportLab
 package into a zip and use zipimport to use it. This causes the
 following error,

 AttributeError: 'HardenedModulesHook' object has no attribute '_files'

 My source where the imports are called,
 import sys
 sys.path.insert(0, 'ho.zip')
 sys.path.insert(0, 'html5lib.zip')
 sys.path.insert(0, 'sx.zip')
 sys.path.insert(0, 'reportlab.zip')
 import ho.pisa as pisa

 Googled a bit for the solution found another mention of this in issue
 tracker,http://code.google.com/p/googleappengine/issues/detail?id=1085.

 Can anyone help me get around this problem? I have seen many use
reportlabin Google App Engine how do you guys get around this issue??

 Any help will be greatly appreciated.

 Thanks,
 Arun Shanker Prasad.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-27 Thread Ruud Helderman

I patched the ReportLab library, works fine for me.

For a simple demo and full source code, look here:
http://ruudhelderman.appspot.com/testpdf

I added a comment with detailed explanation to issue 1085:
http://code.google.com/p/googleappengine/issues/detail?id=1085

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-27 Thread Arun Shanker Prasad

Hi Ruud,

Thanks for the patch, I mentioned your patch comment #5. It is great
and works fine when used with the ReportLab package alone.

My problem is that I use ReportLab as a requirement for the Pisa
package,
(http://www.xhtml2pdf.com/doc/pisa-en.html,
http://pypi.python.org/pypi/pisa/)

Since reportlab is called from inside these packages, they are not
able to find the reportlab package. Do you know of any work around for
this?

Thanks,
Arun Shanker Prasad.

On Apr 25, 7:07 pm, Ruud Helderman liping...@hotmail.com wrote:
 I patched the ReportLab library, works fine for me.

 For a simple demo and full source code, look 
 here:http://ruudhelderman.appspot.com/testpdf

 I added a comment with detailed explanation to issue 
 1085:http://code.google.com/p/googleappengine/issues/detail?id=1085
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-08 Thread Arun Shanker Prasad

Thank you Jeff for the help.

I was actually using ReportLab along with Pisa, I had posted a similar
question on their forum as the demo for this (http://www.xhtml2pdf.com/
demo) seems to be hosted in Google App Engine.

I will try the ReportLab developers also and hope they have a
solution.

Meanwhile can I go ahead and upload the libraries to Google App Engine
and convert it to Zip and reduce the number of files later?

Thanks,
Arun Shanker Prasad.

On Apr 8, 2:09 am, Jeff S j...@google.com wrote:
 Hello Arun Shanker Prasad,

 I'm not familiar with ReportLab, but from reading a tiny bit of their
 documentation it seems like they are interested in making their
 software usable from within App Engine.

 (They mention App Engine on this 
 pagehttp://www.reportlab.org/downloads.html#reportlab
 )

 Have you tried contacting the ReportLab developers? It looks this the
 issue is related to secure runtime restrictions and are triggered by
 the module loader during the import. It would be great if this library
 worked on App Engine, so I'm hoping that we collectively will figure
 this out. I'm not sure if I'll have time to dig in to this issue, as
 much as I'd like to.

 Thank you,

 Jeff

 On Apr 6, 10:23 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
 wrote:

  Hi,

  Anyone got any work-around for my situation? I am stuck at this
  point...

  Thanks,
  Arun Shanker Prasad.

  On Apr 6, 5:12 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
  wrote:

   Hi,

   I have a requirement to generate dynamic PDFs from HTML source. I
   included the Pisa, html5lib and the reportlab packages for this.
   Everything works fine in the local environment as long I keep all the
   packages in the initial source ie I do not zip it.

   Keeping the whole ReportLab package (204 files) might take me way
   close to the allowed file limit. I tried to convert the ReportLab
   package into a zip and use zipimport to use it. This causes the
   following error,

   AttributeError: 'HardenedModulesHook' object has no attribute '_files'

   My source where the imports are called,
   import sys
   sys.path.insert(0, 'ho.zip')
   sys.path.insert(0, 'html5lib.zip')
   sys.path.insert(0, 'sx.zip')
   sys.path.insert(0, 'reportlab.zip')
   import ho.pisa as pisa

   Googled a bit for the solution found another mention of this in issue
   tracker,http://code.google.com/p/googleappengine/issues/detail?id=1085.

   Can anyone help me get around this problem? I have seen many use
   reportlab in Google App Engine how do you guys get around this issue??

   Any help will be greatly appreciated.

   Thanks,
   Arun Shanker Prasad.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---



[google-appengine] Re: Using ReportLab with ZipImport

2009-04-06 Thread Arun Shanker Prasad

Hi,

Anyone got any work-around for my situation? I am stuck at this
point...

Thanks,
Arun Shanker Prasad.

On Apr 6, 5:12 pm, Arun Shanker Prasad arunshankerpra...@gmail.com
wrote:
 Hi,

 I have a requirement to generate dynamic PDFs from HTML source. I
 included the Pisa, html5lib and the reportlab packages for this.
 Everything works fine in the local environment as long I keep all the
 packages in the initial source ie I do not zip it.

 Keeping the whole ReportLab package (204 files) might take me way
 close to the allowed file limit. I tried to convert the ReportLab
 package into a zip and use zipimport to use it. This causes the
 following error,

 AttributeError: 'HardenedModulesHook' object has no attribute '_files'

 My source where the imports are called,
 import sys
 sys.path.insert(0, 'ho.zip')
 sys.path.insert(0, 'html5lib.zip')
 sys.path.insert(0, 'sx.zip')
 sys.path.insert(0, 'reportlab.zip')
 import ho.pisa as pisa

 Googled a bit for the solution found another mention of this in issue
 tracker,http://code.google.com/p/googleappengine/issues/detail?id=1085.

 Can anyone help me get around this problem? I have seen many use
 reportlab in Google App Engine how do you guys get around this issue??

 Any help will be greatly appreciated.

 Thanks,
 Arun Shanker Prasad.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google App Engine group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~--~~~~--~~--~--~---