Yes, this is working. "applications" is in the path. But using
"applications.yourappname.modules.modulename" is specific to web2py.
Python developers are expecting to do "import modulename" otherwise,
it will not work outside of web2py.

On 6 avr, 10:55, grabau....@gmail.com wrote:
> Importing from modules works with absolute import , you must use
>
>  import applications.yourappname.modules.modulename
>
> The path has been set to the directory that web2py is running in - where the 
> web2py.py file is.
> Sent from my BlackBerry® smartphone on the MTS High Speed Mobility Network
>
>
>
>
>
>
>
> -----Original Message-----
> From: pierreth <pierre.thibau...@gmail.com>
>
> Sender: web2py@googlegroups.com
> Date: Wed, 6 Apr 2011 07:39:47
> To: web2py-users<web2py@googlegroups.com>
> Reply-To: web2py@googlegroups.com
> Subject: [web2py] Re: Modularity
>
> Here are my conclusion on using the "modules" directory.
>
> What is working:
>
> - Using local_import avoid collisions of modules or packages that may
> have the same names in other applications.
> - Explicit and implicit relative imports are working well for modules
> located in the "modules" directory.
>
> What is not working:
>
> - Absolute imports does not work because "modules" is not in the
> Python path.
>
> What this mean in practice:
>
> - Modules located in "modules" can import each other if there are not
> located in a package. This is implicit relative import.
> - local_import is working well with both modules and packages.
> - Modules located in "modules", regardless of if they are or not
> located in a package, can only import other modules located both in a
> package and in "modules" using explicit relative imports. Absolute
> imports only work for modules and packages located in the Python path.
>
> So if you drop both a module "a" depending on module "b" in "modules",
> they will probably work very well. But if you drop both a package "a"
> depending on package "b" (or a module "b"), it will probably not work.
> Using relative imports in this case is not the norm. Inter packages
> dependencies will not work in "modules". Is this a bug?
>
> See:http://docs.python.org/tutorial/modules.html#packages
>
> I suggest to add this message to the web2py book.

Reply via email to