[web2py] AttributeError: 'SQLite' object has no attribute 'file_open'

2017-08-02 Thread Sarbjit
Hello All,

I am trying to update the database for my web2py app using the command line 
script :-

Sample Code :-

# Assumption : script is placed inside scripts folder in application
scriptPath = os.path.dirname(os.path.realpath(__file__))
dbPath = os.path.abspath(os.path.join(scriptPath,"../databases"))
libraryPath = os.path.abspath(os.path.join(scriptPath,"../../.."))
sys.path.append(libraryPath)
from gluon import DAL
print dbPath, libraryPath
db = DAL('sqlite://storage.sqlite',folder=dbPath,auto_import=True)

I get the following error :-

Traceback (most recent call last):

  File "populate_database.py", line 19, in 

db = DAL('sqlite://storage.sqlite',folder=dbPath,auto_import=True)

  File 
"/Users/sarbjit/Data/development/python/web2py/gluon/packages/dal/pydal/base.py",
 
line 170, in __call__

obj = super(MetaDAL, cls).__call__(*args, **kwargs)

  File 
"/Users/sarbjit/Data/development/python/web2py/gluon/packages/dal/pydal/base.py",
 
line 500, in __init__

tables=tables)

  File 
"/Users/sarbjit/Data/development/python/web2py/gluon/packages/dal/pydal/base.py",
 
line 522, in import_table_definitions

tfile = self._adapter.file_open(filename, 'r')

AttributeError: 'SQLite' object has no attribute 'file_open'



If I remove the "auto_import" statement, then the connection works fine but 
the following statement fails


db.products.insert(**record)


AttributeError: 'DAL' object has no attribute 'products'


I am using latest web2py version on MAC.


Thanks in advance 

Sarbjit

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] AttributeError: 'SQLite' object has no attribute 'file_open'

2017-07-15 Thread Jitun John
Here is a Code that worked fine on 2.14.6 but doesn't on 2.15.1


import datetime
import gc
import os
from gluon import *
from current_config import *
from memory_profiler import memory_usage


manager_rows = ''


dummy_path = os.path.abspath('.') + '/applications/enLIGHTen/static/dummy/'


def read_alerts_rows():
alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=get_current_path
(), auto_import=True)
global alerts_rows
alerts_rows = alerts_db_conn(alerts_db_conn.alerts_log.id > 0).select(
orderby=alerts_db_conn.alerts_log.datetime)
alerts_db_conn.close()


def get_alerts_rows():
return alerts_rows





def add_clear():
dummy_alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=dummy_path, 
auto_import=True)
global alerts_rows





Gives the following error.

File "applications\enLIGHTen\modules\read_logs_to_rows.py", line 141, in 
add_clear
 dummy_alerts_db_conn = DAL('sqlite://alerts.sqlite', folder=dummy_path, 
auto_import=True)
 File 
"E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
line 170, in __call__
 obj = super(MetaDAL, cls).__call__(*args, **kwargs)
 File 
"E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
line 500, in __init__
 tables=tables)
 File 
"E:\Jitun_Backup\Web2py\web2py_win_2.15.1\gluon\packages\dal\pydal\base.py", 
line 522, in import_table_definitions
 tfile = self._adapter.file_open(filename, 'r')
AttributeError: 'SQLite' object has no attribute 'file_open'

Any pointers/help is appreciated.




-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.