0

Perhaps the problem I'm facing is a little complex, let me try to clarify it.

Currently I have a virtualenv installed in my WSL ubuntu. In this env, I installed a python package using pip. This package provides some convenient cli-interface commands, so if I have activated the env, I can directly run some commands like

(myEnv) name@host: py_cli_cmd --option1 aa --option2 bb ...

Now I have a bash script, defined some variables and invoked the python commands several times, structure like

base_dir=data/
first_dir=$base_dir/first/
second_dir=$base_dir/second/
...
for choice in a b
do
  py_cli_cmd --option1 $choice --option2 $first_dir
done

Now I want to understand the data flow and data structures of the python command, so I planned to use PyCharm to debug it. However I'm facing two problems:

  • I modified the python scripts in pycharm, added some print statements, but seems they took no effect
  • I tried to attach pycharm to the process running in the WSL, but the IDE prompted no processes were found

In such a case can I have any way to debug the python script? Thank you all.

TX Shi
  • 319
  • 1
  • 4
  • 14
  • see if this may [help](https://stackoverflow.com/questions/37000166/getting-pycharm-to-recognize-python-on-the-windows-linux-subsystem-bash-on-wind) – sahasrara62 Dec 30 '19 at 07:24
  • @sahasrara62 Perhaps I didn't quite get your point. I can setup the python interpreter in Pycharm, making it to point to a virtualenv in the WSL (I think this is what the link you provide is for), but my Pycharm cannot be attached to a python process running in the WSL – TX Shi Dec 30 '19 at 07:29
  • you need to setup the ssh tool in pycharm, through ssh you can see the live result of your batch script, seeing live result on terminal is in not possible ( i think), so to solve problem, use logging, and after completion of code see what went wring in log file – sahasrara62 Dec 30 '19 at 07:55

0 Answers0