From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Jul 13 2016 - 01:35:55 CDT

Hi,
  On Windows, VMD performs it's I/O to stdin/stdout as on Unix, however
the behavior of stdin/stdout on Windows are determined by the MS C runtime
and it wouldn't surprise me at all if they don't handle process pipes
in the way we would expect, furthermore, the Windows console API is used
by VMD to determine if it has a controlling terminal or if it's doing
I/O to files. It wouldn't surprise me if some aspect of that is not
happy when attached through a pipe to the calling Python process.
I suppose what I would recommend is to compile a simple hello world app
on Windows and test it the same way you're testing VMD and see if that works
or if this is a general Python/Windows pipe issue of some kind.
If you want to communicate with VMD via a Python script, there are also
other ways, such as having VMD listen to a socket via a short Tcl script
or similar.

Cheers,
  John Stone
  vmd_at_ks.uiuc.edu

On Mon, Jul 11, 2016 at 10:35:40PM +0200, Pawel Kedzierski wrote:
> Dear all,
> I have a Python script which calls 'vmd -startup none -nt -dispdev none
> -eofexit' with the support of the Popen.communicate() from the
> subprocess module.
> I feed a few commands to VMD (load a pdb file and make some
> atomselect's) to get list of atoms belonging to some selections.
> This is the recommended way in Python of communication with external
> programs, and Popen.communicate() run separate threads for writing to
> the process stdin and to poll stdout in order to avoid deadlocks.
> Nevertheless, on Windows it does deadlock (tested on Windows 10 x64 with
> python 2.7, both native and from Cygwin).
> On Linux the script works.
> I do not use Windows daily and this was rather for my colleague who is
> not a Linux native, but still I wonder if this is a Python bug, or maybe
> VMD does something unusual with stdin/stdout and there is a workaround.
> Any suggestions or comments are welcome.
> Cheers,
> Pawe??
>

-- 
NIH Center for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
http://www.ks.uiuc.edu/~johns/           Phone: 217-244-3349
http://www.ks.uiuc.edu/Research/vmd/