Windows agent not showing command outputs

Hello there. 

I've just created a new build configuration (command line) meant to be executed in a Windows agent. I've added a few debug lines (pip -V and echo) so that I can check everything writes to stdout as expected; but there're no outputs shown besides common INFO messages from checkouts, workdir, cmd script to run and so on. No outputs shown from actual commands in build configuration.

Is there a configuration I'm missing?

PS: I've a TeamCity installation with near 100 build configurations, running in both Windows and Linux, all of them running normally and as expected; this is the only one not showing outputs for some reason.

Thanks!

 

8 comments
Comment actions Permalink

The command-line build steps should include the output of your echo commands in the build log. Can you provide an example of a script that does not seem to be working for you? If you'd be more comfortable, you are welcome to use the Submit a Request button at the top of the page to share things privately.

0
Comment actions Permalink

Hi Eric.

Thanks for you response.

I've found that the issue occurs only when configuring a Python virtual environment; after activating it, it won't show any output from any debug print command (furthermore, won't run any command at all). I've tried with Python3.6 and 3.7 and even added a exit 1 line to force a failure, nothing happens.

While not bein in a virtual environment, echo and other commands work as expected, no issues there.

Is there a know incompatibility with Windows agents and Python virtual enviroments? In command line (cmd) I'm able to run anything normally, same directories, same virtual environments. Could this be related with TeamCity agent identity (user running the service) in that instance?

Thanks!

 

0
Comment actions Permalink

Hi Mariano,

Thanks for writing back. I don't know of any incompatibility between Windows agents and Python virtual environments, but I was able to reproduce your issue. It seems the output streams from the Python virtual environment are not being recognized as stdout or stderr and therefore not being logged in the build log. 

However, I found if I were to use PowerShell to launch the virtual environment, the echo and pip -V commands show up in the build log. Would this be an acceptable approach for now? I'll continue to look into the CMD issue, in the meantime.

1
Comment actions Permalink

Hi Eric.
Let me try that and let you know.

Thanks again!

0
Comment actions Permalink

Hi Eric.

I've used Powershell to launch virtual environment, still not showing any output to stdout. I've tried the following:

powershell
[path_venv]\activate
python -V

it does show PS prompt on build log, but no actual output. Also tried activating directly as:

powershell [path_venv]\activate

but that doesn't trigger the activate itself.

 

Going a bit further, it won't run any command in powershell (not even a get-host or a $PSVersionTable).

 

PS: it all works normally by doing the same in cmd manually.

 

How have you done it?

Thanks!

0
Comment actions Permalink

I just used a simple PowerShell runner and placed the script in the runner itself. See attached screenshots:

1
Comment actions Permalink

Thanks Eric, that works correctly.

Just out of curiosity, is that a common issue on windows runners? can I help debugging this for you?

Thanks!

0
Comment actions Permalink

I don't think it is a common issue since I haven't found any other records of it being reported previously. I think the issue itself is that the output from the Python venv is not being detected in the stdout or stderr stream when used within Windows CMD. For whatever reason, PowerShell responds differently.

Perhaps there is a way to launch the venv while ensuring the output is in either stdout or stderr? Sometimes I'll map the stderr of a script in CMD to the stdout stream using 2>&1. I'm not an expert on Python virtual environments, so I'm not sure. Do you know how to do this?

0

Please sign in to leave a comment.