Skip to content

Hide python switching warning message #5177

@Dragas

Description

@Dragas
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

Issue

I am going to tell you about weirdest process yet.

For reasons I must write development code on windows machine, but I can only run python (and in turn, poetry) on my development virtual machine via SSH. Intellij offers such functionality via "SSH Interpreter" where you project would be synchronized to remote machine and then invoked via SSH. This works fine (both debugging, and running) without poetry.

In the project that we are developing we must use python 3.9 (as per the minimal reproducable sample), but ubuntu 20.04 server comes with 3.8 by default, and it seems that upgrading to 3.9 breaks some parts of the operating system. This is circumvented by installing 3.9 via apt and setting default version to 3.8 via update-alternatives tool. When you use non-required version to run poetry, poetry checks the operating system for installed python versions and switches to it, but emits a warning message. This breaks Intellij's debugging mode via SSH, because intellij runs the project twice (first with some debugging arguments to determine address and port, second time the actual project), and uses stdout from first invocation to pass address and port for remote debugging. Since poetry outputs a warning message that python was switched, the invoked commandline from

ssh://[email protected]:22/home/python/.poetry/bin/poetry_wrapped.sh -u /home/python/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support=auto --client "0.0.0.0" --port 38929 --file /home/python/main.py

becomes

ssh://[email protected]:22/home/python/.poetry/bin/poetry_wrapped.sh -u /home/python/.pycharm_helpers/pydev/pydevd.py --multiproc --qt-support=auto --client "he currently activated Python version 3.8.10 is not supported by the project (^3.9).
Trying to find and use a compatible version. 
Using python3.9 (3.9.5)
('0.0.0.0'" --port 38929 --file /home/python/main.py

As a result, the entire warning message gets passed as host, and in turn breaks debugging runtime.

Due to this very specific issue I would like a commandline argument to mute the python switching warning message. -q argument does not work, because pydevd debugger uses stdout to communicate current status with intellij, and that flag mutes all stdout.

Addendum 1: poetry_wrapped.sh script

#!/bin/bash
/home/python/.poetry/bin/poetry run "python3" "$@"

The script is used because intellij only accepts interpreter fully qualified path as parameter, and does not permit prefixing more arguments to the commandline.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions