How to import pydal

44 views
Skip to first unread message

Luca

unread,
Oct 14, 2019, 6:47:10 PM10/14/19
to web2py-users
I cloned pydal from github.  Then, from the directory where I cloned pydal, which is ~/work/WikiTrust2/data_interface, I tried to import it. 
However, I get an error: I can import DAL, but an import within pydal itself fails, probably because pydal does not know how to import its own modules due to Python 3 new import model. 

So my question is:  if I want to clone pydal from github as a submodule as part of a larger project, how do I then import pydal into the project? 

I am probably confused by the Python 3 import model (I was used to Python 2); can someone help me out? 

Many thanks, 

Luca

from pydal.pydal import DAL
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-bd4ce315d283> in <module>
----> 1 from pydal.pydal import DAL

~/work/WikiTrust2/data_interface/pydal/pydal/__init__.py in <module>
      1 __version__ = '20190915.2'
      2
----> 3 from .base import DAL
      4 from .objects import Field
      5 from .helpers.classes import SQLCustomType

~/work/WikiTrust2/data_interface/pydal/pydal/base.py in <module>
    146 from .objects import Table, Field, Rows, Row, Set
    147 from .adapters.base import BaseAdapter, NullAdapter
--> 148 from .default_validators import default_validators
    149
    150 TABLE_ARGS = set(

~/work/WikiTrust2/data_interface/pydal/pydal/default_validators.py in <module>
     10 """
     11
---> 12 from . import validators
     13
     14 def default_validators(db, field):

~/work/WikiTrust2/data_interface/pydal/pydal/validators.py in <module>
     29 from functools import reduce
     30
---> 31 from pydal._compat import StringIO, integer_types, basestring, unicodeT, urllib_unquote, \
     32     unichr, to_bytes, PY2, to_unicode, to_native, string_types, urlparse, ipaddress
     33 from pydal.objects import Field, FieldVirtual, FieldMethod, Table

ModuleNotFoundError: No module named 'pydal._compat'
Reply all
Reply to author
Forward
0 new messages