Debug python code launched from another python script in neovim - python

I am trying to move from pycharm to neovim.
And I am searching for one feature pycharm is able to do somehow (magically).
I have master python script that launches another script as an external program (subprocess.Popen).
I would like to have opportunity to use breakpoints in the slave script. What I have now is that vimspector is ok with breakpoints in master script, but just ignores all the breakpoints in slave script.
Is there any debug plugin that is able to trace breakpoints in the script launched from another script?

Related

Debugging any Known Python File Ran by an Interpreter

I'm trying to debug any Python script that an interpreter runs so long and I have a reference to that script. I.e if my connected interpreter runs a script called abc.py, and in my script directory I have abc.py with breakpoints attached. The IDE will automatically stop execution at that break point
I'm using PyCharm, but I'd like to know the theory here to say if I'd ever like to connect VS Code I'd be able to do that as well. Additionally I'm currently connecting to a Docker container running airflow.
Given the above, I'm assuming that the goal is to do a "remote" debug.
Also since Python is a script, and run by an interpreter I am assuming, if I can read into the interpreter and if PyCharm can match the file ran by the interpreter then it should be able to pause the execution.
I am additionally assuming that the interpreter can run in "normal" mode. Not in debug mode as we have in Java.
I have read three approaches:
ssh interpreter to my Docker container - seems most promising for my current goal, but unsure if it'll work
using Python debug server (Debugging Airflow Tasks with IDE tools?) - still requires manual changes in the specific scripts
using Docker interpreter (https://medium.com/#andrewhharmon/apache-airflow-using-pycharm-and-docker-for-remote-debugging-b2d1edf83d9d) - still requires individual debug configs for executing a single DAG / script
Is debugging any file executed by a python interpreter possible, at least in theory?
Is it possible remotely?
Is it possible using airflow at all?

Run PyCharm with command on PC Startup

I am using PyCharm in two instances for crypto-trading. Currently when my computer starts up, I would have to open both projects on PyCharm manually and enter two different commands manually.
Is there a way to run these projects with the commands needed automatically right after starting my computer?
A better way to start your bot on startup is to add your python script or something in a startup or run your python script as a service.
Check out this article

Shared script does not execute

A .pyw script to present a small GUI (TkInter) to the user. From a Windows Server Terminal server, it does not run for others.
I wrote a .pyw script to present a small GUI (TkInter) to the user. On my windows desktop, with Python installed, it runs well. I uploaded the script to a Windows Server Terminal server, from where I want a number of users to run it. I can run it when I log onto the terminal server. Other users, however, cannot run it, and it does not display any error messages.
I have ensured that everyone on the server has full access to the script.
The code is running perfectly
Uhm... This was rather simpler than I thought.
Because it is a .pyw file, an error did not show up. I did not make use of Python's errror catching tools.

Jenkins run a script in background

How can I trigger a script say A (in python) using Jenkins such that a shell script triggered internally from script A keeps running in background even after Jenkins build is done.
Right now, what I observe is that as soon as Jenkins job ends, it kills the background shell script too.
However, running the python script manually on the terminal is fine.
Is there a way that I can skip killing that background shell script from Jenkins?
After searching for the solution, I came across this link "Spawning process from build"
https://wiki.jenkins.io/display/JENKINS/Spawning+processes+from+build
Adding below command to build step helped:
BUILD_ID=dontKillMe nohup shell_script_to_run.sh &

remote debugging in pycharm, debugging a subprocess

Good Day!
I have a script which runs on Python3.5, It spawns a subprocess which runs a java application.
subprocess.run(["/usr/bin/java","-jar",<pathToMyJar>])
This Java application internally invokes some of my python scripts which runs on Jython2.5.
So I want to debug those Jython scripts, I'm enabling remote debugging in the start of my jython script. Check the following code which does that,
sys.path.append(os.path.join(libspath, "pycharm-debug.egg"))
import pydevd
pydevd.settrace('localhost', port=9999, stdoutToserver=True, stderrToServer=True, suspend=True)
I have created a debug server on my Pycharm with same host and port as above, every time before running my script I start my server on Pycharm but I can't able to debug my Jython scripts.On pycharm I can able to see waiting for process connection.., after that nothing happens.
what is wrong with my approach, is there anything I'm missing here.
I'm using Pycharm-2018.1.2 professional version on ubuntu.

Categories

Resources