Pycharm does not activate venv when debugging - no problem when simply run - debugging

As in a title. I run the project in venv. It runs correctly with Run Configurations without debug mode but in the debug mode seems not to have the venv activated (spits out errors about modules not found). What could be the reason? I can add more details if you need but I am not sure what could be useful.
EDIT: After closer inspection it looks like the debugger mode does not use the Debug Configurations at all. I've got Python app specified with app.py as a path, debugger tries to run Flask app and core.py.

Related

Pycharm - Missing module only when debugging

PyCharm behaves strange. When click on run, the project executes. But click on debug, it fails with a module which could not be found.
This module is a own module importet to python path via the project settings.
Is there a different environment setup for debugging then for running a project? How can I alter the environment for debugging to the same as the run environment?

How to debug code running from terminal in pycharm

I am running my code in Pycharm from Terminal. Is it possible to debug the code and put breakpoints inside the code during a run from terminal?
I don't know anyway to do this through the terminal, but the way I currently do it is:
Run > Edit Configurations > Add new configuration (the green + button)
Choose Python
Fill out Script path, Parameters, and other configuration fields.
Debug the newly added configuration. (Run > Debug...)
With the right configuration the result should be the same as running the script in a terminal.
I find the above process a little tedious. A PEP 553 breakpoint() might be nicer. It requires Python 3.7 and is not implemented yet. See the related issue.
Even if the program is started outside of PyCharm, we can attach PyCharm debugger to it.
Go to Run -> Attach to process.
This will show a list of python process that are currently running on the system. Select the appropriate process from it.
Now PyCharm debugger is connected to that process. We can add breakpoints and debug it.
There is a way using python console.
To run it: Tools -> python console .. or you can find it at the bottom of the IDE.
Then press on 'Attach debugger' line in the following picture:
Add a breakpoint in your code and then pass the file name to the cosole, like: %run my_file.py

How to debug a scratch file in Pycharm

I am running python3.5 from a venv and am using PyCharm 5. My debugger works fine on normal scripts but doesn't allow me to step through my code at all on a scratch file. Is this normal? It won't even let me set breakpoints. Its driving me bonkers that I can't debug them!
This looks like a bug in pycharm 5.0 - PY-17575 Can no longer set breakpoints in scratch files

Develop and debug Python 3 applications in a virtual environment with Komodo IDE 8

I was trying to develop and debug Python 3 applications in a virtual environment with Komodo IDE.
I applied all the project settings, tried out my tests and did a lot of research using google, stackoverflow and also tried sarchiung the komodo forums for "virtual environment" oder "venv".
My impression is, that this cannot be done at the present. Or is there a way?
How can debugging in a Python3 Virtual Environment be done in the current commercial Komodo IDE version on windows?
Debugging in a Python3 Virtual Environment does not work yet in the current Komode IDE version on windows.
My experience is, that even if the path is properly set on debug sessions in the project settings, those are ignored in the debug session and even worse, Komodo uses c:\Python27 which should not be visible in the session.
Example:
I have c:\python27 and c:\python33 on the system
My Python 3 VENV is in c:\project\demo and I added the python 3 exe from c:\project\demo\scripts\python.exe to the project settings
I also set the environment variabels PYTHONPATH and PATH to
c:\project\demo\scripts\ respectively c:\project\demo\ and c:\project\demo\mylib
Also c:\project\demo\mylib is added to the python3 search paths.
I can run my tests from a VENV from the console withpout any problem, which has exactly the mentioned configuration.
Now I open the file with the test in the Komodo project and run / debug it.
The result is that the debug session cannot import from c:\project\demo\mylib. When I print the environment in the debug session, it shows me that it is set to c:\Python27
I wonder why all those settings exist if the debug session does not use them.

Meteor debug on server side on windows with node-inspector

I am running meteor on Windows, possibly a minority here. I searched and found solutions for Linux and possibly Mac but no one has provide solutions for Windows. Maybe someone can help?
First I modified the meteor.bat file under C:\Program Files (x86)\Meteor to included --debug as mentioned in other posts:
#echo off&&"%METEOR_PATH%\bin\node.exe" --debug "%METEOR_PATH%\app\meteor\meteor.js" %*
I started my node-inspector and received an instruction to visit 0.0.0.0:8080/debug?port=5858 to start debugging
I then started my meteor application, but when I go to http://127.0.0.1:8080/debug?port=5858 I saw two squares: one for Scripts, and one for console. Nothing came up when selecting Scripts.
Does Windows have the same issue as Linux, spawning two processes but only one with the debug flag?
Version 0.5.3 added the NODE_OPTIONS environment variable that passes those parameters directly to node.
So fire-up your favorite js debugger like node-inspector
Assuming you already have it installed, call
node-inspector
Then
set NODE_OPTIONS = --debug
meteor
Do this inside your project folder, you can also use the --debug-brk to break immediately on start
In Chrome open localhost:8080 in a new tab
Have fun

Resources