No, No.

If you need to use third party packages you must run from source.
Assuming you do it...

There are three places to put modules:
1) web2py/applications/XXX/modules
2) web2py/
3) The Python site-packages folder (that is where they go when
installed with easy_install)

1) should only be used for packages that are to be distributed with
apps. This does not work for all packages. In particular this does not
work if the package expects to be in 3)

2) that is where web2py system packages go. Please do not mess it up.

3) That is the proper way. This is what you would do with any Python
app and any other Python web framework.
Use easy_install to install the packages and they will go in site-
packages automatically. Then import it with

     from GChartWrapper import *

This way the same package will be shared by all apps.

WARGINING: Never modify the os.path from the apps. This is not thread
safe.


Massimo

On Jul 27, 4:14 pm, Yarko Tymciurak <yark...@gmail.com> wrote:
> On Mon, Jul 27, 2009 at 3:40 PM, Dan <danbr...@gmail.com> wrote:
>
> > Is the appropriate solution to put the library code in web2py/ and use
> > this import statement?
> > from GChartWrapper import *
>
> > that seems to work, but I'd prefer to have the library in web2py/
> > applications/myapp/modules/
>
> then you will need to use something like:
>
> from applications.myapp.modules.GChartWrapper import *
>
>
>
> > On Jul 27, 12:24 pm, Dan <danbr...@gmail.com> wrote:
> > > Hello-
> > > I'd like to use some google charts (http://code.google.com/apis/
> > > chart/) in my web2py app. Instead of creating the URLs manually, I
> > > would prefer to use a wrapper library, and this one looks like a good
> > > candidate:http://code.google.com/p/google-chartwrapper/
>
> > > So I tried to put the code from that library in the /web2py/
> > > applications/myapp/modules/ directory and then import it in my
> > > controller, like this ...
>
> > > exec('from applications.%s.modules import
> > > GChartWrapper'%request.application)
>
> > > ... but I get this error:
>
> > >   File ".../modules/GChartWrapper/__init__.py", line 1, in <module>
> > >     from GChartWrapper.GChart import *
> > > ImportError: No module named GChartWrapper.GChart
>
> > > Is there a proper way to import this kind of library? Or do I need to
> > > make changes to the library's __init__.py file and other files?
>
> > > thanks,
> > > Dan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to