ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Pycharm Debugging


#21

Yea, I am still having the same issues on my windows machine inside Pycharm.


#22

using the local pycharms debugger is fidly i use the pycharms pro version and the remote debugger which i can then just paste a breakpoint into code
i also use the remote deployment to auto sync files to my vm and remote db access to have easily displayed database access
you can also setup a remote interperter so i knows imports


#23

Can we do debugging in Spyder instead of Pycharm ?? If Yes , then How it can be done?


#24

Hi ppl.
I was able to run the debug, but when I load the page it gives error below

listening on *: 9000
13:02:10 watch.1 | Wrote ./assets/js/print_format_v3.min.js - 25k
13:02:10 watch.1 | Wrote ./assets/js/frappe-web.min.js - 141k
13:02:10 watch.1 | Wrote ./assets/js/form.min.js - 181k
13:02:10 watch.1 | Wrote ./assets/js/report.min.js - 252k
13:02:10 watch.1 | Wrote ./assets/js/erpnext.min.js - 104k
13:02:10 watch.1 | Wrote ./assets/css/list.min.css - 8k
13:02:10 watch.1 | Wrote ./assets/js/item-dashboard.min.js - 7k
13:02:10 watch.1 | Wrote ./assets/js/d3.min.js - 380k
13:02:10 watch.1 | Wrote ./assets/css/report.min.css - 8k
13:02:10 watch.1 | Wrote ./assets/css/frappe-web.css - 64k
13:02:10 watch.1 | Wrote ./assets/js/list.min.js - 146k
13:02:10 watch.1 | Wrote ./assets/js/dialog.min.js - 85k
13:02:10 worker_default.1 | 13:02:10 RQ worker u’rq:worker:harada-Lenovo.17906.default’ started, version 0.7.1
13:02:10 worker_default.1 | 13:02:10 Cleaning registries for queue: default
13:02:10 worker_default.1 | 13:02:10
13:02:10 worker_default.1 | 13:02:10 *** Listening on default…
13:02:10 watch.1 | Wrote ./assets/js/desk.min.js - 332k
13:02:10 watch.1 | Wrote ./assets/css/form.min.css - 4k
13:02:10 watch.1 | Wrote ./assets/js/editor.min.js - 45k
13:02:10 watch.1 | Wrote ./assets/css/erpnext.css - 3k
13:02:10 watch.1 | Wrote ./assets/js/libs.min.js - 885k
13:02:10 watch.1 | Wrote ./assets/js/erpnext-web.min.js - 4k
13:02:10 watch.1 | Wrote ./assets/css/desk.min.css - 278k
13:02:10 watch.1 | Wrote ./assets/css/module.min.css - 2k
13:02:10 worker_long.1 | 13:02:10 RQ worker u’rq:worker:harada-Lenovo.17883.long’ started, version 0.7.1
13:02:10 worker_long.1 | 13:02:10 Cleaning registries for queue: long
13:02:10 worker_long.1 | 13:02:10
13:02:10 worker_long.1 | 13:02:10 *** Listening on long…
13:02:10 web.1 | * Running on http://0.0.0.0:8000/ (Press CTRL+C to quit)
13:02:10 web.1 | * Restarting with inotify reloader
13:02:11 worker_short.1 | 13:02:11 RQ worker u’rq:worker:harada-Lenovo.17899.short’ started, version 0.7.1
13:02:11 worker_short.1 | 13:02:11 Cleaning registries for queue: short
13:02:11 worker_short.1 | 13:02:11
13:02:11 worker_short.1 | 13:02:11 *** Listening on short…
13:02:11 web.1 | * Debugger is active!
13:02:11 web.1 | * Debugger PIN: 121-731-690
13:02:15 web.1 | Could not find app “None”
13:02:15 web.1 | Could not find app “None”
13:02:15 web.1 | 127.0.0.1 - - [08/Jun/2017 13:02:15] “GET /api/method/frappe.async.get_user_info?sid=69c855ee69cc0fe61a4f8edf3c9cce32d79d8aba59e7a7a005b6c093 HTTP/1.1” 500 -
13:02:15 web.1 | Traceback (most recent call last):
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/middlewares.py”, line 15, in call
13:02:15 web.1 | return super(StaticDataMiddleware, self).call(environ, start_response)
13:02:15 web.1 | File “/home/harada/frappe/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 600, in call
13:02:15 web.1 | return self.app(environ, start_response)
13:02:15 web.1 | File “/home/harada/frappe/env/lib/python2.7/site-packages/werkzeug/wsgi.py”, line 600, in call
13:02:15 web.1 | return self.app(environ, start_response)
13:02:15 web.1 | File “/home/harada/frappe/env/lib/python2.7/site-packages/werkzeug/local.py”, line 228, in application
13:02:15 web.1 | return ClosingIterator(app(environ, start_response), self.cleanup)
13:02:15 web.1 | File “/home/harada/frappe/env/lib/python2.7/site-packages/werkzeug/wrappers.py”, line 301, in application
13:02:15 web.1 | return f(*args[:-2] + (request,))(*args[-2:])
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/app.py”, line 81, in application
13:02:15 web.1 | response = handle_exception(e)
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/app.py”, line 145, in handle_exception
13:02:15 web.1 | response = frappe.website.render.render(“message”, http_status_code=http_status_code)
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/website/render.py”, line 22, in render
13:02:15 web.1 | path = resolve_path(path or frappe.local.request.path.strip(’/ '))
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/website/render.py”, line 166, in resolve_path
13:02:15 web.1 | path = resolve_from_map(path)
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/website/render.py”, line 172, in resolve_from_map
13:02:15 web.1 | for r in frappe.get_hooks(“website_route_rules”)])
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/init.py”, line 794, in get_hooks
13:02:15 web.1 | hooks = _dict(cache().get_value(“app_hooks”, load_app_hooks))
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/utils/redis_wrapper.py”, line 70, in get_value
13:02:15 web.1 | val = generator()
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/init.py”, line 775, in load_app_hooks
13:02:15 web.1 | app_hooks = get_module(app + “.hooks”)
13:02:15 web.1 | File “/home/harada/frappe/apps/frappe/frappe/init.py”, line 666, in get_module
13:02:15 web.1 | return importlib.import_module(modulename)
13:02:15 web.1 | File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
13:02:15 web.1 | import(name)
13:02:15 web.1 | ImportError: No module named hooks
13:02:15 socketio.1 | { Error: Internal Server Error
13:02:15 socketio.1 | at Request.callback (/home/harada/frappe/node_modules/superagent/lib/node/index.js:675:11)
13:02:15 socketio.1 | at IncomingMessage. (/home/harada/frappe/node_modules/superagent/lib/node/index.js:883:18)
13:02:15 socketio.1 | at emitNone (events.js:91:20)
13:02:15 socketio.1 | at IncomingMessage.emit (events.js:185:7)
13:02:15 socketio.1 | at endReadableNT (_stream_readable.js:974:12)
13:02:15 socketio.1 | at _combinedTickCallback (internal/process/next_tick.js:80:11)
13:02:15 socketio.1 | at process._tickCallback (internal/process/next_tick.js:104:9)
13:02:15 socketio.1 | status: 500,
13:02:15 socketio.1 | response:
13:02:15 socketio.1 | Response {
13:02:15 socketio.1 | domain: null,
13:02:15 socketio.1 | _events: {},
13:02:15 socketio.1 | _eventsCount: 0,
13:02:15 socketio.1 | _maxListeners: undefined,
13:02:15 socketio.1 | res:
13:02:15 socketio.1 | IncomingMessage {
13:02:15 socketio.1 | _readableState: [Object],
13:02:15 socketio.1 | readable: false,
13:02:15 socketio.1 | domain: null,
13:02:15 socketio.1 | _events: [Object],
13:02:15 socketio.1 | _eventsCount: 4,
13:02:15 socketio.1 | _maxListeners: undefined,
13:02:15 socketio.1 | socket: [Object],
13:02:15 socketio.1 | connection: [Object],
13:02:15 socketio.1 | httpVersionMajor: 1,
13:02:15 socketio.1 | httpVersionMinor: 0,
13:02:15 socketio.1 | httpVersion: ‘1.0’,
13:02:15 socketio.1 | complete: true,
13:02:15 socketio.1 | headers: [Object],
13:02:15 socketio.1 | rawHeaders: [Object],
13:02:15 socketio.1 | trailers: {},
13:02:15 socketio.1 | rawTrailers: [],
13:02:15 socketio.1 | upgrade: false,
13:02:15 socketio.1 | url: ‘’,
13:02:15 socketio.1 | method: null,
13:02:15 socketio.1 | statusCode: 500,
13:02:15 socketio.1 | statusMessage: ‘INTERNAL SERVER ERROR’,
13:02:15 socketio.1 | client: [Object],
13:02:15 socketio.1 | _consuming: true,
13:02:15 socketio.1 | _dumped: false,
13:02:15 socketio.1 | req: [Object],
13:02:15 socketio.1 | text: '\n\n \n ImportError: No module named hooks // Werkzeug Debugger\n <link rel=“stylesheet” href="?debugger=yes&cmd=resource&f=style.css"\n type=“text/css”>\n \n <link rel=“shortcut icon”\n href="?debugger=yes&cmd=resource&f=console.png">\n \n \n \n \n \n

\n

ImportError

\n
\n

ImportError: No module named hooks

\n
\n

Traceback (most recent call last)

\n
\n \n
  • \n

    File “/home/harada/frappe/apps/frappe/frappe/middlewares.py”,\n line <em
    13:02:15 socketio.1 | method: ‘GET’,
    13:02:15 socketio.1 | path: ‘/api/method/frappe.async.get_user_info?sid=69c855ee69cc0fe61a4f8edf3c9cce32d79d8aba59e7a7a005b6c093’ },
    13:02:15 socketio.1 | accepted: false,
    13:02:15 socketio.1 | noContent: false,
    13:02:15 socketio.1 | badRequest: false,
    13:02:15 socketio.1 | unauthorized: false,
    13:02:15 socketio.1 | notAcceptable: false,
    13:02:15 socketio.1 | forbidden: false,
    13:02:15 socketio.1 | notFound: false,
    13:02:15 socketio.1 | type: ‘text/html’,
    13:02:15 socketio.1 | charset: ‘utf-8’,
    13:02:15 socketio.1 | links: {},
    13:02:15 socketio.1 | setEncoding: [Function: bound ],
    13:02:15 socketio.1 | redirects: [] } }
    13:02:15 web.1 | Could not find app “None”
    13:02:15 web.1 | Could not find app “None”


#25


Hi @fellipeh please Help me here. bench starts but exits immediately.


#26

Hi Nauman,
Did you fix that?
I have the same problem as you. I’m using pycharm profressional and when I run the proyect exits immediately.

That’s my log

/usr/bin/python2.7 -u /usr/local/bin/bench start
11:22:08 system | watch.1 started (pid=14747)
11:22:08 system | worker_long.1 started (pid=14746)
11:22:08 system | web.1 started (pid=14751)
11:22:08 system | schedule.1 started (pid=14754)
11:22:08 system | worker_short.1 started (pid=14757)
11:22:08 system | redis_cache.1 started (pid=14758)
11:22:08 redis_cache.1 | .
11:22:08 redis_cache.1 | .-__ ''-._ 11:22:08 redis_cache.1 | _.- .. ‘’-._ Redis 3.0.6 (00000000/0) 64 bit
11:22:08 redis_cache.1 | .-.-```. ```\/ _.,_ ''-._ 11:22:08 redis_cache.1 | ( ' , .-` | `, ) Running in standalone mode 11:22:08 redis_cache.1 | |`-._`-...-` __...-.-.|’_.-'| Port: 13001 11:22:08 redis_cache.1 | |-. ._ / _.-' | PID: 14769 11:22:08 redis_cache.1 |-._ -._-./ .-’ .-’
11:22:08 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_cache.1 | |-.
-._ _.-'_.-' | http://redis.io 11:22:08 redis_cache.1 |-._ -._-..-’.-’ .-’
11:22:08 redis_cache.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_cache.1 | |-.
-._ _.-'_.-' | 11:22:08 redis_cache.1 |-._ -._-.
.-’.-’ .-’
11:22:08 redis_cache.1 | -._-..-’ _.-’
11:22:08 redis_cache.1 | -._ _.-' 11:22:08 redis_cache.1 |-.
.-’
11:22:08 redis_cache.1 |
11:22:08 redis_cache.1 | 14769:M 09 Feb 11:22:08.361 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11:22:08 redis_cache.1 | 14769:M 09 Feb 11:22:08.361 # Server started, Redis version 3.0.6
11:22:08 redis_cache.1 | 14769:M 09 Feb 11:22:08.361 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
11:22:08 redis_cache.1 | 14769:M 09 Feb 11:22:08.361 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
11:22:08 redis_cache.1 | 14769:M 09 Feb 11:22:08.361 * The server is now ready to accept connections on port 13001
11:22:08 system | redis_socketio.1 started (pid=14745)
11:22:08 redis_socketio.1 | .
11:22:08 redis_socketio.1 | .-__ ''-._ 11:22:08 redis_socketio.1 | _.- .. ‘’-.
Redis 3.0.6 (00000000/0) 64 bit
11:22:08 redis_socketio.1 | .-.-```. ```\/ _.,_ ''-._ 11:22:08 redis_socketio.1 | ( ' , .-` | `, ) Running in standalone mode 11:22:08 redis_socketio.1 | |`-._`-...-` __...-.-.
|’_.-'| Port: 12001 11:22:08 redis_socketio.1 | |-._ ._ / _.-' | PID: 14774 11:22:08 redis_socketio.1 |-._ -._-./ .-’ .-’
11:22:08 redis_socketio.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_socketio.1 | |-.
-._ _.-'_.-' | http://redis.io 11:22:08 redis_socketio.1 |-._ -._-..-’.-’ .-’
11:22:08 redis_socketio.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_socketio.1 | |-.
-._ _.-'_.-' | 11:22:08 redis_socketio.1 |-._ -._-.
.-’.-’ .-’
11:22:08 redis_socketio.1 | -._-..-’ _.-’
11:22:08 redis_socketio.1 | -._ _.-' 11:22:08 redis_socketio.1 |-.
.-’
11:22:08 redis_socketio.1 |
11:22:08 redis_socketio.1 | 14774:M 09 Feb 11:22:08.365 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11:22:08 redis_socketio.1 | 14774:M 09 Feb 11:22:08.372 # Server started, Redis version 3.0.6
11:22:08 redis_socketio.1 | 14774:M 09 Feb 11:22:08.372 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
11:22:08 redis_socketio.1 | 14774:M 09 Feb 11:22:08.372 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
11:22:08 redis_socketio.1 | 14774:M 09 Feb 11:22:08.372 * The server is now ready to accept connections on port 12001
11:22:08 system | redis_queue.1 started (pid=14753)
11:22:08 redis_queue.1 | .
11:22:08 redis_queue.1 | .-__ ''-._ 11:22:08 redis_queue.1 | _.- .. ‘’-.
Redis 3.0.6 (00000000/0) 64 bit
11:22:08 redis_queue.1 | .-.-```. ```\/ _.,_ ''-._ 11:22:08 redis_queue.1 | ( ' , .-` | `, ) Running in standalone mode 11:22:08 redis_queue.1 | |`-._`-...-` __...-.-.
|’_.-'| Port: 11001 11:22:08 redis_queue.1 | |-._ ._ / _.-' | PID: 14778 11:22:08 redis_queue.1 |-._ -._-./ .-’ .-’
11:22:08 redis_queue.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_queue.1 | |-.
-._ _.-'_.-' | http://redis.io 11:22:08 redis_queue.1 |-._ -._-..-’.-’ .-’
11:22:08 redis_queue.1 | |-._-.
-.__.-' _.-'_.-'| 11:22:08 redis_queue.1 | |-.
-._ _.-'_.-' | 11:22:08 redis_queue.1 |-._ -._-.
.-’_.-’ _.-’
11:22:08 redis_queue.1 | -._-..-’ _.-’
11:22:08 redis_queue.1 | -._ _.-' 11:22:08 redis_queue.1 |-.
.-’
11:22:08 redis_queue.1 |
11:22:08 redis_queue.1 | 14778:M 09 Feb 11:22:08.396 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
11:22:08 redis_queue.1 | 14778:M 09 Feb 11:22:08.396 # Server started, Redis version 3.0.6
11:22:08 system | worker_default.1 started (pid=14755)
11:22:08 redis_queue.1 | 14778:M 09 Feb 11:22:08.397 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add ‘vm.overcommit_memory = 1’ to /etc/sysctl.conf and then reboot or run the command ‘sysctl vm.overcommit_memory=1’ for this to take effect.
11:22:08 redis_queue.1 | 14778:M 09 Feb 11:22:08.397 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled’ as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
11:22:08 redis_queue.1 | 14778:M 09 Feb 11:22:08.397 * The server is now ready to accept connections on port 11001
11:22:08 system | socketio.1 started (pid=14756)
11:22:09 socketio.1 | listening on *: 9001
11:22:09 watch.1 | Usage: bench [OPTIONS] COMMAND [ARGS]…
11:22:09 watch.1 |
11:22:09 watch.1 | Error: No such command “watch”.
11:22:09 worker_long.1 | Usage: bench [OPTIONS] COMMAND [ARGS]…
11:22:09 worker_long.1 |
11:22:09 worker_long.1 | Error: No such command “worker”.
11:22:09 schedule.1 | Usage: bench [OPTIONS] COMMAND [ARGS]…
11:22:09 schedule.1 |
11:22:09 schedule.1 | Error: No such command “schedule”.
11:22:09 system | schedule.1 stopped (rc=2)
11:22:09 system | sending SIGTERM to redis_socketio.1 (pid 14745)
11:22:09 system | sending SIGTERM to worker_long.1 (pid 14746)
11:22:09 system | sending SIGTERM to watch.1 (pid 14747)
11:22:09 system | sending SIGTERM to redis_queue.1 (pid 14753)
11:22:09 system | sending SIGTERM to web.1 (pid 14751)
11:22:09 system | sending SIGTERM to worker_default.1 (pid 14755)
11:22:09 system | sending SIGTERM to socketio.1 (pid 14756)
11:22:09 system | sending SIGTERM to redis_cache.1 (pid 14758)
11:22:09 system | sending SIGTERM to worker_short.1 (pid 14757)
11:22:09 redis_socketio.1 | 14774:signal-handler (1518171729) Received SIGTERM scheduling shutdown…
11:22:09 redis_queue.1 | 14778:signal-handler (1518171729) Received SIGTERM scheduling shutdown…
11:22:09 redis_cache.1 | 14769:signal-handler (1518171729) Received SIGTERM scheduling shutdown…
11:22:09 system | web.1 stopped (rc=-15)
11:22:09 system | worker_long.1 stopped (rc=-15)
11:22:09 system | worker_default.1 stopped (rc=-15)
11:22:09 system | worker_short.1 stopped (rc=-15)
11:22:09 system | socketio.1 stopped (rc=-15)
11:22:09 system | watch.1 stopped (rc=-15)
11:22:09 redis_queue.1 | 14778:M 09 Feb 11:22:09.497 # User requested shutdown…
11:22:09 redis_queue.1 | 14778:M 09 Feb 11:22:09.497 # Redis is now ready to exit, bye bye…
11:22:09 system | redis_queue.1 stopped (rc=-15)
11:22:09 redis_socketio.1 | 14774:M 09 Feb 11:22:09.549 # User requested shutdown…
11:22:09 redis_socketio.1 | 14774:M 09 Feb 11:22:09.549 # Redis is now ready to exit, bye bye…
11:22:09 system | redis_socketio.1 stopped (rc=-15)
11:22:09 redis_cache.1 | 14769:M 09 Feb 11:22:09.563 # User requested shutdown…
11:22:09 redis_cache.1 | 14769:M 09 Feb 11:22:09.563 # Redis is now ready to exit, bye bye…
11:22:09 system | redis_cache.1 stopped (rc=-15)


#27

Here’s a tip to followup Missing bench commands for development


#28

Hi,
finally I could fix the issue. This is the configuration that works for me.

PyCharm 2017.3.2 (Professional Edition)
Erpnext 10

Also, you have to configure the virtual enviroment of python. What I did was:
cd /home/frappe/dev-bench (change dev-bench with your current bench directory)
source env/bin/activate
pip install --user -e bench-repo (where bench-repo is the downloaded code)
After that you can run the proyect from pycharm.

If you want to debug a python script called from ajax, the breakpoints will not work. You have to configure another debug profile with remote debug option.

Thanks


#29

This works
Thanks