Try ERPNext Buy Support Partners Foundation

Getting pymql.err.ProgrammingError

I am getting below error on my site,

pymysql.err.ProgrammingError

pymysql.err.ProgrammingError

Traceback (most recent call last)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/middlewares.py”, line 15 , in __call__

return super(StaticDataMiddleware, self).call(environ, start_response)

  • File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/werkzeug/wsgi.py”, line 766 , in __call__

return self.app(environ, start_response)

  • File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/werkzeug/wsgi.py”, line 766 , in __call__

return self.app(environ, start_response)

  • File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/werkzeug/local.py”, line 228 , in application

return ClosingIterator(app(environ, start_response), self.cleanup)

  • File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/werkzeug/wrappers.py”, line 308 , in application

resp = f(*args[:-2] + (request,))

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/app.py”, line 78 , in application

response = frappe.utils.response.handle_session_stopped()

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/response.py”, line 222 , in handle_session_stopped

return frappe.website.render.render(“message”, http_status_code=503)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/website/render.py”, line 34 , in render

resolve_redirect(path)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/website/redirect.py”, line 24 , in resolve_redirect

redirects += frappe.db.get_all(‘Website Route Redirect’, [‘source’, ‘target’])

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 527 , in get_all

return frappe.get_all(*args, **kwargs)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1293 , in get_all

return get_list(doctype, *args, **kwargs)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1266 , in get_list

return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 95 , in execute

result = self.build_and_run()

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 109 , in build_and_run

args = self.prepare_args()

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 135 , in prepare_args

self.set_optional_columns()

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 292 , in set_optional_columns

columns = frappe.db.get_table_columns(self.doctype)

  • File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 854 , in get_table_columns

raise self.TableMissingError

pymysql.err.ProgrammingError

Check it on console
sudo /etc/init.d/mysql start
and then restart the site

Thanks @Namrata for your reply. Though i did few steps here and there. though the site still shows me the error. i ran these steps:
bench restart
bench clear-cache
bench build
bench restart
bench update -reset

now currently i am getting this error on console:

Executing erpnext.patches.v12_0.set_produced_qty_field_in_sales_order_for_work_order in admin.lexcis.com (_7687565e79783d56)
Success: Done in 0.922s
Executing erpnext.patches.v12_0.set_default_shopify_app_type in admin.lexcis.com (_7687565e79783d56)
Success: Done in 0.324s
Executing erpnext.patches.v12_0.set_cwip_and_delete_asset_settings in admin.lexcis.com (_7687565e79783d56)
Traceback (most recent call last):
File “/usr/lib64/python3.6/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/lib64/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
main()
File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
return self.main(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
rv = self.invoke(ctx)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
return callback(*args, **kwargs)
File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
ret = f(frappe.dict(ctx.obj), *args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 233, in migrate
migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 48, in migrate
frappe.modules.patch_handler.run_all(skip_failing)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
run_patch(patch)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
if not run_single(patchmodule = patch):
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v12_0/set_cwip_and_delete_asset_settings.py”, line 12, in execute
cwip_value = frappe.db.get_single_value(“Asset Settings”,“disable_cwip_accounting”)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/database.py”, line 559, in get_single_value
frappe.throw(
(‘Invalid field name: {0}’).format(frappe.bold(fieldname)), self.InvalidColumnName)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 360, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’)
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 346, in msgprint
_raise_exception()
File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 315, in _raise_exception
raise raise_exception(msg)
frappe.database.database.InvalidColumnName: Invalid field name: disable_cwip_accounting

Have you checked your mysql status ?? ,if not check with the help of command
sudo /etc/init.d/mysql status

Yes its is running

HEY! USE SCREEN -bash-4.2# sudo /etc/init.d/mysql status
MariaDB running (3597) [ OK ]
HEY! USE SCREEN -bash-4.2#

awaiting your reply @namrata

@root13F can you help on this one?

This column seems to be the problem.

Can you run command bench version and post it here. One more suggestion i would make is to check if both Frappe and erpnext are on the same branch that is version-12 for v12

Also, did you INTEND to install version 12 ?

@root13F

HEY! USE SCREEN -bash-4.2# bench version
erpnext 12.x.x-develop
foundation 0.0.1
frappe 12.x.x-develop

I already have the setup; was using the system as well, for some reason; it showed me 502 bad gateway; i read few articles and ran these commands;
bench restart
bench clear-cache
bench build
bench restart
bench update -reset

and then i got this error on my site - admin.lexcis.com

Hey @root13F / @Namrataa awaiting solution

Try below command.
sudo mysqld --tc-heuristic-recover=ROLLBACK
sudo service mysqld restart

I don’t have a solution but a workaround.

I think this error could be avoided if you switch to some stable branch of erpnext instead. Can you switch to version 11 instead or do you intend to use version 12 only.

use bench switch-to-branch version-11 in your folder

Yes i can use version 11 as well, can i later update to 12 once it gets in working state ?

I will try this command now - switch-to-branch version-11

HEY! USE SCREEN -bash-4.2# bench switch-to-branch version-11
remote: Enumerating objects: 272, done.
remote: Counting objects: 100% (272/272), done.
remote: Compressing objects: 100% (25/25), done.
remote: Total 324 (delta 257), reused 250 (delta 247), pack-reused 52
Receiving objects: 100% (324/324), 76.09 KiB | 0 bytes/s, done.
Resolving deltas: 100% (263/263), completed with 142 local objects.
From https://github.com/frappe/erpnext
2578d49…c9203a1 develop -> upstream/develop
3f854fc…f37a46e v12-pre-release -> upstream/v12-pre-release
f06b31a…3ad65ec version-11 -> upstream/version-11
9c7a334…dafdc60 version-11-hotfix -> upstream/version-11-hotfix

  • [new tag] v11.1.69 -> v11.1.69
    Switching for erpnext
    INFO:bench.utils:git config --unset-all remote.upstream.fetch
    INFO:bench.utils:git config --add remote.upstream.fetch ‘+refs/heads/:refs/remotes/upstream/
    INFO:bench.utils:git fetch upstream
    INFO:bench.utils:git checkout version-11
    Branch version-11 set up to track remote branch version-11 from upstream.
    Switched to a new branch ‘version-11’
    INFO:bench.utils:git merge upstream/version-11
    Already up-to-date.
    remote: Enumerating objects: 26, done.
    remote: Counting objects: 100% (26/26), done.
    remote: Compressing objects: 100% (22/22), done.
    remote: Total 26 (delta 10), reused 9 (delta 3), pack-reused 0
    Unpacking objects: 100% (26/26), done.
    From https://github.com/frappe/frappe_io
    45e6594…31b9f21 master -> upstream/master
  • [new branch] hooks-update -> upstream/hooks-update
    Branch version-11 does not exist in Upstream for frappe_io
    remote: Enumerating objects: 385, done.
    remote: Counting objects: 100% (385/385), done.
    remote: Compressing objects: 100% (9/9), done.
    remote: Total 591 (delta 377), reused 377 (delta 376), pack-reused 206
    Receiving objects: 100% (591/591), 116.58 KiB | 0 bytes/s, done.
    Resolving deltas: 100% (429/429), completed with 115 local objects.
    From https://github.com/frappe/frappe
    222b9a5…5da2a5b develop -> upstream/develop
    a0c0041…3a73cf6 v12-pre-release -> upstream/v12-pre-release
    c0f10a1…c2d5239 version-11-hotfix -> upstream/version-11-hotfix
    Switching for frappe
    INFO:bench.utils:git config --unset-all remote.upstream.fetch
    INFO:bench.utils:git config --add remote.upstream.fetch ‘+refs/heads/:refs/remotes/upstream/
    INFO:bench.utils:git fetch upstream
    INFO:bench.utils:git checkout version-11
    error: Your local changes to the following files would be overwritten by checkout:
    yarn.lock
    Please, commit your changes or stash them before you can switch branches.
    Aborting
    Error switching to branch version-11 for frappe
    Branch version-11 does not exist in Upstream for foundation
    Successfully switched branches for:
    erpnext
    Switched to version-11
    Please run bench update --patch to be safe from any differences in database schema
    HEY! USE SCREEN -bash-4.2# bench update --patch
    Backing up sites…
    Patching sites…
    Migrating admin.lexcis.com
    Executing erpnext.patches.v11_1.set_quotation_status in admin.lexcis.com (_7687565e79783d56)
    Success: Done in 0.071s
    Executing erpnext.patches.v11_1.set_produced_qty_field_in_sales_order_for_work_order in admin.lexcis.com (_7687565e79783d56)
    Traceback (most recent call last):
    File “/usr/lib64/python3.6/runpy.py”, line 193, in _run_module_as_main
    main”, mod_spec)
    File “/usr/lib64/python3.6/runpy.py”, line 85, in _run_code
    exec(code, run_globals)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 97, in
    main()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 18, in main
    click.Group(commands=commands)(prog_name=‘bench’)
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 764, in call
    return self.main(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 717, in main
    rv = self.invoke(ctx)
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/core.py”, line 555, in invoke
    return callback(*args, **kwargs)
    File “/home/frappe/frappe-bench/env/lib/python3.6/site-packages/click/decorators.py”, line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/init.py”, line 25, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py”, line 233, in migrate
    migrate(context.verbose, rebuild_website=rebuild_website, skip_failing=skip_failing)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/migrate.py”, line 48, in migrate
    frappe.modules.patch_handler.run_all(skip_failing)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 41, in run_all
    run_patch(patch)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 30, in run_patch
    if not run_single(patchmodule = patch):
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 71, in run_single
    return execute_patch(patchmodule, method, methodargs)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 91, in execute_patch
    frappe.get_attr(patchmodule.split()[0] + “.execute”)()
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 1029, in get_attr
    return getattr(get_module(modulename), methodname)
    File “/home/frappe/frappe-bench/apps/frappe/frappe/init.py”, line 810, in get_module
    return importlib.import_module(modulename)
    File “/home/frappe/frappe-bench/env/lib64/python3.6/importlib/init.py”, line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File “”, line 994, in _gcd_import
    File “”, line 971, in _find_and_load
    File “”, line 955, in _find_and_load_unlocked
    File “”, line 665, in _load_unlocked
    File “”, line 678, in exec_module
    File “”, line 219, in _call_with_frames_removed
    File “/home/frappe/frappe-bench/apps/erpnext/erpnext/patches/v11_1/set_produced_qty_field_in_sales_order_for_work_order.py”, line 2, in
    from erpnext.selling.doctype.sales_order.sales_order import update_produced_qty_in_so_item
    File “/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/sales_order/sales_order.py”, line 17, in
    from frappe.desk.doctype.auto_repeat.auto_repeat import get_next_schedule_date
    ModuleNotFoundError: No module named ‘frappe.desk.doctype.auto_repeat.auto_repeat’

@root13F Now it’s

erpnext 11.1.68
foundation 0.0.1
frappe 12.x.x-develop

this also must be version 11, same as erpnext. I think you may have got an error where version-11 could not be fetched for frappe. Hence follow the instructions on this link and try the same command again:

  1. open location frappe-bench/apps/frappe/.git
  2. then open file named config in your editor
  3. replace it by this text:
[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "upstream"]
        url = https://github.com/frappe/frappe.git
        fetch = +refs/heads/version-11:refs/remotes/upstream/version-11
[branch "version-11"]
        remote = upstream
        merge = refs/heads/version-11

again try bench switch-to-branch version-11

Thanks @root13F i performed the steps mentioned by you. still getting some error

HEY! USE SCREEN -bash-4.2# bench switch-to-branch version-11
Switching for erpnext
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch ‘+refs/heads/:refs/remotes/upstream/
INFO:bench.utils:git fetch upstream
INFO:bench.utils:git checkout version-11
Already on ‘version-11’
INFO:bench.utils:git merge upstream/version-11
Already up-to-date.
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/frappe/frappe_io
31b9f21…e03b91f master -> upstream/master
Branch version-11 does not exist in Upstream for frappe_io
Switching for frappe
INFO:bench.utils:git config --unset-all remote.upstream.fetch
INFO:bench.utils:git config --add remote.upstream.fetch ‘+refs/heads/:refs/remotes/upstream/
INFO:bench.utils:git fetch upstream
INFO:bench.utils:git checkout version-11
error: Your local changes to the following files would be overwritten by checkout:
** yarn.lock**
Please, commit your changes or stash them before you can switch branches.
Aborting
Error switching to branch version-11 for frappe
Branch version-11 does not exist in Upstream for foundation
Successfully switched branches for:
erpnext
Switched to version-11
Please run bench update --patch to be safe from any differences in database schema
HEY! USE SCREEN -bash-4.2# bench version
erpnext 11.1.68
foundation 0.0.1
frappe 12.x.x-develop

There are some changes in frappe alp folder i.e. apps/frappe that are not committed.

Just open frappe folder in terminal and use command git stash. And try again

@Prakhil_Samar

Use git stash command in frappe app and then use bench switch-to-branch version-11

Thanks @root13F @Onkar_Mirajkar for your reply and solution.

@root13F I have switched to version 11

HEY! USE SCREEN -bash-4.2# bench version
erpnext 11.1.68
foundation 0.0.1
frappe 11.1.62

But still site gives error - https://admin.lexcis.com