Answer a question

i using VSCode as my IDE for development odoo and for now run using Start > Debugging ( F5)

While running at web browser localhost:8069 ( default ) then appear Internal Server Error and in terminal VSCode there are errors :

Traceback (most recent call last):
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 63, in __new__
    return cls.registries[db_name]
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: 'usu02' #this my database name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/serving.py", line 323, in run_wsgi
    execute(self.server.app)
  File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/serving.py", line 312, in execute
    application_iter = app(environ, start_response)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/server.py", line 441, in app
    return self.app(e, s)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/wsgi_server.py", line 113, in application
    return application_unproxied(environ, start_response)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/service/wsgi_server.py", line 88, in application_unproxied
    result = odoo.http.root(environ, start_response)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1306, in __call__
    return self.dispatch(environ, start_response)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1272, in __call__
    return self.app(environ, start_wrapped)
  File "/home/teguhteja/P/OdooProject/odoo1/.venv/lib/python3.7/site-packages/werkzeug/middleware/shared_data.py", line 260, in __call__
    return self.app(environ, start_response)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/http.py", line 1461, in dispatch
    odoo.registry(db).check_signaling()
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/__init__.py", line 104, in registry
    return modules.registry.Registry(database_name)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 65, in __new__
    return cls.new(db_name)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/registry.py", line 89, in new
    odoo.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 457, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 349, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/loading.py", line 179, in load_module_graph
    load_openerp_module(package.name)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/modules/module.py", line 385, in load_openerp_module
    __import__('odoo.addons.' + module_name)
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/__init__.py", line 4, in <module>
    from . import models
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/models/__init__.py", line 6, in <module>
    from . import res_partner
  File "/home/teguhteja/P/OdooProject/odoo1/odoo-14.0/odoo/addons/base_vat/models/res_partner.py", line 7, in <module>
    import stdnum
ModuleNotFoundError: No module named 'stdnum' - - -

and i tried to searching and found here

  1. How to fix "ModuleNotFoundError: No module named 'python-stdnum'"
  2. UnicodeDecodeError: 'charmap' codec| Error during installation of pip python-stdnum==1.8

and then

pip install python-stdnum == 1.17 # new version

but result is same. and i check about my pip list

pip list

appdirs           1.4.4
attrs             21.2.0
Babel             2.6.0
backcall          0.2.0
bcrypt            3.2.0
beautifulsoup4    4.10.0
cached-property   1.5.2
certifi           2021.10.8
cffi              1.15.0
chardet           3.0.4
decorator         4.3.0
defusedxml        0.7.1
docutils          0.14
ebaysdk           2.1.5
freezegun         0.3.11
future            0.18.2
gevent            1.5.0
greenlet          0.4.15
html2text         2018.1.9
idna              2.6
ipdb              0.13.9
ipython           7.30.1
isodate           0.6.0
jedi              0.18.1
Jinja2            2.10.1
libsass           0.17.0
lxml              4.3.2
Mako              1.0.7
MarkupSafe        1.1.0
matplotlib-inline 0.1.3
num2words         0.5.6
ofxparse          0.19
parso             0.8.3
passlib           1.7.1
pexpect           4.8.0
pickleshare       0.7.5
Pillow            5.4.1
pip               21.3.1
polib             1.1.0
prompt-toolkit    3.0.24
psutil            5.8.0
psycopg2          2.7.7
ptyprocess        0.7.0
pyasn1            0.4.8
pyasn1-modules    0.2.8
pycparser         2.21
pydot             1.4.1
Pygments          2.10.0
pyodbc            4.0.32
pyparsing         3.0.6
PyPDF2            1.26.0
pyserial          3.4
python-dateutil   2.7.3
python-ldap       3.1.0
python-stdnum     1.17
pytz              2019.1
pyusb             1.0.2
pyzk              0.9
qrcode            6.1
reportlab         3.5.13
requests          2.21.0
requests-toolbelt 0.9.1
setuptools        41.2.0
six               1.16.0
soupsieve         2.3.1
toml              0.10.2
traitlets         5.1.1
urllib3           1.24.3
vobject           0.9.6.1
wcwidth           0.2.5
Werkzeug          0.16.1
wheel             0.37.0
xlrd              1.1.0
XlsxWriter        1.1.2
xlwt              1.3.0

and i found my python-stdnum already installed

i suspect my problem at launch.json vscode

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Odoo",
            "type": "python",
            "request": "launch",
            "stopOnEntry": false,
            "python": "${command:python.interpreterPath}",
            // "console": "externalTerminal",
            "program": "${workspaceRoot}/odoo-14.0/odoo-server",
            "args": [
                "--config=${workspaceRoot}/conf/odoo-training14.conf",
            ],
            "cwd": "${workspaceRoot}",
            // "env": {},
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "RedirectOutput"
            ]
        }
    ]
}

how to fix my problem ?

ALTERNATIVE currently i run odoo using below command and for debug using ipdb

python3 odoo-14.0/odoo-server -c conf/odoo-training14.conf

Answers

After trying for a few days and just found out that pip and python in the project are not pointing to .venv but to anaconda due to an update. when error

no module stdnum

actually there is a problem with pip so make sure your pip path with which pip or which python

  1. to solve .venv that doesn't work by deleting the .venv folder, create venv in python, and install all requirements again
rm .venv
python3 -m venv .venv
source .venv/bin/activate.fish
python3 -m pip install --upgrade pip # upgrade pip
pip install -r requirements.txt
  1. since it uses vscode make sure your interpreter with ctrl + shift + P then

Python : Select Interpreter

and choose your .venv

after that you can debug as usual

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐