0

(windows 7 pro, python 2.7, PIP 9.0.1)

During the deployment process of our tools on client workstations, I use pip to install custom python libs. Because of the way it is packaged, I cannot have a pip.exe, so I run the pip module with pythonw to avoid the popping of a console.

$ c:\installdir\pythonw.exe -m pip install mylib --index http://pypi.intranet.org

mylib has a console entrypoint (let's call it mylibutil) defined in the setup.py file. So a mylibutil.exe is generated at install time which is fine.

But when I run it, nothing happens in my console. After parsing the content of the generated executable, I saw that the python used to run the script is c:\installdir\pythonw.exe, so not the correct one for a console script, but indeed the same one that was used when calling PIP.

Is there any workaround? Is this a win-specific bug of PIP?

I can use python instead of pythonw at install time, that would be alright, but I know the popping consoles can frighten some of the users sometimes.

NOTE: I found this trick to wrap my python call through a no-console VBS script. So that's a workaround. However, I'd like it to keep things simpler if possible.

Olivier H
  • 835
  • 2
  • 8
  • 26
  • To keep things within Python, you can write a run_nocon.pyw script that uses `subprocess.call` to run a provided command line, with `creationflags` set to `CREATE_NO_WINDOW` (0x08000000), i.e. attach to a console host (conhost.exe) that doesn't create a window. This is even better than running pip via pythonw.exe, since any child process that an installation script creates will inherit the windowless console instead of creating a new console. – Eryk Sun Dec 04 '17 at 10:34
  • @eryksun, nice idea to not to depend on yet something else than python. I'll give it a try. – Olivier H Dec 06 '17 at 08:00

0 Answers0