You can definitively do that. You can use any module that works with python 
with web2py. You just have to make some choices about whether you want to 
distribute your module with your app or not.

If you do not want to distribute it with your app:
- If you run web2py from source you can put it into the normal python 
site-packages
- if you run web2py binary, you have to put your module in 
web2py/site-packages

If you do want to distribute it with your app, then it is a web2py specific 
logic.
- you have to put it into web2py/applications/yourapp/modules/ and you 
still import with "import modulename".
Not all modules can be distributed distributed in 
web2py/applications/yourapp/modules/. Only modules that do not assume they 
are in site-packages and use relative import.

Massimo



On Monday, 7 December 2015 17:03:36 UTC-6, Jitun John wrote:
>
>
> Hi I am an amateur programmer and new to web2py.
>
> I have written python scripts with apsw imported. (
> http://rogerbinns.github.io/apsw/)
> It allows me to create a db in the memory and once all 
> processing/insertion is done, one can backup the date to an .sqlite file on 
> the disk.
> This .sqlite file can be read and loaded into the memory at some later 
> point in time as well.
> I was wondering if I can import apsw into web2py module .py (apsw works 
> with python 2.x)
> At present I get "Cannot import module applications.admin.modules.apsw"
>
>     mem_db_connection = apsw.Connection(":memory:")
>     cursor = mem_db_connection.cursor()
>
>     # Copy from memory to file
>     with global_db_backup_con.backup("main", mem_db_connection, "main") as 
> backup:
>         backup.step()   # copy whole database in one go
>
> If not, then is there anything similar I can use in web2py ?
> I plan to make a simple log analysis app which runs on locally on clients 
> unit.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to