[web2py] Re: importing local modules

2010-02-28 Thread mdipierro
I did not express myself properly. They could be added but, in import, python would search the paths in the order they where appended in sys.path. Therefore you may be importing a module from a different app instead of the one you want. It would cause confusion. On Feb 26, 10:32 am, Jonathan Lund

Re: [web2py] Re: importing local modules

2010-02-26 Thread Jonathan Lundell
On Feb 26, 2010, at 4:42 AM, mdipierro wrote: > the modules/ folder > IS NOT and CANNOT be added to the search path. Why is that? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To

Re: [web2py] Re: importing local modules

2010-02-26 Thread Jonathan Lundell
On Feb 26, 2010, at 3:46 AM, Tiago Almeida wrote: > How do you usually import a module from a module. I've tried using > local_import but I had problems (don't remember details) so I solved the > problem by hardcoding the path like 'applications./modules/...' but > don't like it. > Can local_im

Re: [web2py] Re: importing local modules

2010-02-26 Thread Thadeus Burgess
So a simple modules/mymoduleA.py modules/mymoduleB.py # mymoduleA.py import mymoduleB.py def functionA(): print mymoduleB.functionB() should work ? -Thadeus On Fri, Feb 26, 2010 at 6:42 AM, mdipierro wrote: > The problem with Python is that path for searching modules is one for > each

[web2py] Re: importing local modules

2010-02-26 Thread mdipierro
The problem with Python is that path for searching modules is one for each process and not one per thread or one per application. This means if you use third part modules you should install them AS IF web2py was not there and import them from web2py in the usual way. If you want to make some modu

Re: [web2py] Re: importing local modules

2010-02-26 Thread Tiago Almeida
Allow me to hijack this thread for a related question. How do you usually import a module from a module. I've tried using local_import but I had problems (don't remember details) so I solved the problem by hardcoding the path like 'applications./modules/...' but don't like it. Can local_import do

Re: [web2py] Re: importing local modules

2010-02-25 Thread Thadeus Burgess
Done. -Thadeus On Thu, Feb 25, 2010 at 7:06 PM, Jonathan Lundell wrote: > On Feb 25, 2010, at 4:19 PM, mr.freeze wrote: > >> Just do: dt = local_import('datatables') > > Thanks. Maybe the book should reflect this: > http://web2py.com/book/default/section/4/18 > > (I'd make the change, but I

Re: [web2py] Re: importing local modules

2010-02-25 Thread Jonathan Lundell
On Feb 25, 2010, at 4:19 PM, mr.freeze wrote: > Just do: dt = local_import('datatables') Thanks. Maybe the book should reflect this: http://web2py.com/book/default/section/4/18 (I'd make the change, but I'm a little fuzzy on the details.) > > On Feb 25, 6:11 pm, Jonathan Lundell wrote: >> I'

[web2py] Re: importing local modules

2010-02-25 Thread mr.freeze
Just do: dt = local_import('datatables') On Feb 25, 6:11 pm, Jonathan Lundell wrote: > I've made a module that does a nice job, if I do say so myself, of > encapsulating DataTables (I'll post something about it eventually). > > Since it's a module, I need to import it to my controller, which I'm