Hello,

I am trying to use PyDAL from a Python 3 script. I pip installed it without 
issue but when attempting to open up an existing database (created with 
web2py running on Python 2.6) I get the following error:

form pydal import DAL
db = DAL('sqlite://sqlite.db', folder=db_path, auto_import=True)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.5/site-packages/pydal/base.py", line 174, in 
__call__
    obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/pydal/base.py", line 496, in 
__init__
    tables=tables)
  File "/usr/local/lib/python3.5/site-packages/pydal/base.py", line 512, in 
import_table_definitions
    sql_fields = pickle.load(tfile)
TypeError: a bytes-like object is required, not 'str'


Which I can trace to these line of source code

for filename in glob.glob(pattern):
    tfile = self._adapter.file_open(filename, 'r')
    try:
        sql_fields = pickle.load(tfile)


I believe tfile must be opened in 'rb' mode in Python 3. Is there a 
workaround so I can get this working? I have other needs that require 
Python 3 over Python 2.

Thanks

-- 
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