Hello all, Have just joined this group, and this is my first post. I have actually been following web2py since year 2009. At that time, I was deciding which language and which webapp framework to use. Web2py is the one I have chosen and I have been spending a lot of time on it. This is my first question here, since I can't find the answer/ confirmation in Google search.
I am trying to add Pygments script as part of my webapp so that its functionality can be called in my controllers. First of all I try adding the pygments folder to my specific app's / modules folder, and do a local_import('pygments', reload=True) in my models/db.py file. Following that, I put in this sample code (the sample expected output as per the pygments quickstart page.) ( http://pygments.org/docs/quickstart/ ) from pygments import highlight from pygments.lexers import PythonLexer from pygments.formatters import HtmlFormatter code = 'print "Hello World"' print highlight(code, PythonLexer(), HtmlFormatter()) I get a couple of errors here. 1. Inside the pygments' folder original __init__.py file , there is this line >> from pygments.util import StringIO, BytesIO ImportError: No module named pygments.util Here, the reference to "pygments.util" will cause an error? Which I solved by renaming it to simply "util". But on to next line... 2. After doing that, I get an error on the next lines, >>from pygments.lexers import PythonLexer 'module' object has no attribute 'lexers'. Eventually I got everything working by giving up on putting pygments in modules/ -- as I intended to , and instead (reluctantly) put it in the web2pySource's /site-packages folder. Q. My question is -- does this mean that code placed in the modules/ folder and imported through 'local_import', is not actually able to be 100% equivalent as having the original script installed in the python environment(not an option for me) or putting it as a global web2py site-package? Just want to confirm that there is a difference in putting a script package in app/modules compared to putting it in the global web2py source site-packages. Thanks.