Error importing pydal running from PyCharm

33 views
Skip to first unread message

Tom Øyvind Hogstad

unread,
Sep 29, 2023, 1:33:47 PM9/29/23
to web2py-users
Hi,
when running my web2py app from pycharm I get an error importing pydal.
The directory is a full source download, so the full dal package is included.
When I run direct from command line It works.
I'm working in MacOS Ventura on a Macbook Air M2.

Commandline
tom@Tom-sin-MacBook-Air-2022 w2p % python3 web2py.py -a "admin"
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2023
Version 2.24.1-stable+timestamp.2023.03.23.05.07.17
Database drivers available: sqlite3, psycopg2, imaplib, pymysql, pyodbc

please visit:
http://127.0.0.1:8000/
use "kill -SIGTERM 1726" to shutdown the web2py server

From Pycharm
/usr/bin/python3 /Users/tom/Source/w2p/web2py.py -a admin
Traceback (most recent call last):
File "/Users/tom/Source/w2p/gluon/__init__.py", line 31, in import_packages
sys.modules[package] = __import__(package)
File "/Users/tom/Source/w2p/gluon/packages/dal/pydal/__init__.py", line 3, in <module>
from .base import DAL
File "/Users/tom/Source/w2p/gluon/packages/dal/pydal/base.py", line 136, in <module>
from ._compat import (
File "/Users/tom/Source/w2p/gluon/packages/dal/pydal/_compat.py", line 90, in <module>
from html.parser import HTMLParser
File "/Users/tom/Source/w2p/gluon/html.py", line 21, in <module>
from pydal._compat import PY2, reduce, pickle, copyreg, HTMLParser, name2codepoint, iteritems, unichr, unicodeT, \
ImportError: cannot import name 'HTMLParser' from partially initialized module 'pydal._compat' (most likely due to a circular import) (/Users/tom/Source/w2p/gluon/packages/dal/pydal/_compat.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/tom/Source/w2p/web2py.py", line 43, in <module>
import gluon.widget
File "/Users/tom/Source/w2p/gluon/__init__.py", line 35, in <module>
import_packages()
File "/Users/tom/Source/w2p/gluon/__init__.py", line 33, in import_packages
raise RuntimeError(MESSAGE % package)
RuntimeError: web2py depends on pydal, which apparently you have not installed.
Probably you cloned the repository using git without '--recursive'
To fix this, please run (from inside your web2py folder):

git submodule update --init --recursive

You can also download a complete copy from http://www.web2py.com.

Process finished with exit code 1

Tom Ø.

Tom Øyvind Hogstad

unread,
Sep 29, 2023, 2:50:17 PM9/29/23
to web2py-users
I actually solved it myself.
Pycharm with old settings that included gluon as an external library injected gluon into the path.
Then web2py html.py was picked up instead of the new python3 html.py
Clearing my old .idea file and setting up a new solved it.

Tom Ø.

Reply all
Reply to author
Forward
0 new messages