#1563 closed defect (fixed)
Various ChimeraX startup switches ineffective in Windows
| Reported by: | Tristan Croll | Owned by: | Greg Couch |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Command Line | Version: | |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | Windows 10 | |
| Project: | ChimeraX |
Description
The following commands just drop back to the shell with no apparent effect (all work fine in Linux and MacOS):
"C:\Program Files\ChimeraX\bin\ChimeraX.exe" --nogui "C:\Program Files\ChimeraX\bin\ChimeraX.exe" --nogui --cmd "devel install ." "C:\Program Files\ChimeraX\bin\ChimeraX.exe" -m sphinx source build
I can work around it, but Sphinx in particular is a pain to run from the inside.
Change History (12)
comment:1 by , 7 years ago
| Status: | assigned → accepted |
|---|
comment:2 by , 6 years ago
Bumping this, since it's broken me again. ChimeraX command-line switches don't work for me either in the standard Windows command prompt or in a Cygwin64 terminal - either way the command just immediately returns without doing anything. With the previous version of Sphinx I was still able to build my documentation by hacking together a script that replicated the Sphinx shell command from within ChimeraX itself, but the new version looks to have a completely revamped API. Will see if I can find my way around it.
comment:3 by , 6 years ago
It seems Sphinx really isn't designed to be called from inside the Python environment it's trying to document. I think I got it to work via the absolutely appalling hack of calling ChimeraX as a subprocess from within a ChimeraX shell... at least, it started flashing up latex windows for a while before the shell closed itself.
comment:4 by , 6 years ago
Nope - didn't work. Something of a problem now - I honestly don't know how I can rebuild my documentation in Windows. I suppose I could hack it by pushing the built documentation up to my Git repository, but I've wanted to avoid that.
follow-up: 5 comment:5 by , 6 years ago
OK, crisis averted. This works: "c:\Program Files\ChimeraX\bin\python.exe" "c:\Program Files\ChimeraX\bin\Lib\site-packages\ChimeraX_main.py" -m sphinx source ..\src\docs\isolde On 2019-07-02 20:12, ChimeraX wrote:
comment:6 by , 6 years ago
The problem is that ChimeraX.exe is a "windows desktop application" and not a "console application". We didn't want it to be a console application because that always creates a console when not run from a console, so double-clicking on the app icon would create a (useless) console.
The current "nogui" mode does not work when invoked from a Windows "Command Prompt" because sys.stdout, sys.stderr and sys.stdin are all None, because ChimeraX.exe is not a console app. Any code referencing those file objects (setting up coloring, printing status and error messages, etc.) causes Python to exit with an exception, which you cannot see because there is no console.
When starting no "nogui" mode, I have only two choices:
- Attach to the parent (Command Prompt) console. This mostly works. The problem is that Command Prompt does not wait for desktop apps to finish before moving on to the next command. This can be solved by starting ChimeraX.exe with:
start /wait d:\chimerax\ChimeraX.app\bin\ChimeraX.exe --nogui --nowait --cmd "echo hello; exit"
which tells Command Prompt to wait before continuing. Of course, the solution is immediately obvious only to developers familiar with Windows. - Allocate a new console. This option creates a new console window and sends the output (and gets its input) there. The problem is that the window flashes up and disappears so quickly that you cannot read the output. The common solution to this is to print "Press ENTER to continue", which many apps do, and exit after receiving input. Obviously this doesn't work in a batch environment, but it does work rather well when double-clicking a "nogui" ChimeraX icon. I can add a "--nowait" option to ChimeraX to eliminate waiting for input, but that does not solve the "cannot read output" problem.
So what are your opinions on what is the "right" fix?
follow-up: 7 comment:7 by , 6 years ago
What about a separate dedicated nogui console executable (e.g. ChimeraX-nogui.exe)?
comment:10 by , 6 years ago
There should be a ChimeraX-console.app in addition to ChimeraX.app in the daily build. The console app takes exactly the same arguments as the desktop app, so you still have to give the --nogui flag when using it for running "devel" commands. One nice side effect of this is that you can now have a shortcut to "ChimeraX-console.app --debug" and see a console window with the debug messages.
Can you give this a try? Also, can you try it with the commands from ticket #2597 ("Toolshed unwanted version downgrade on Windows")? Thanks.
follow-up: 11 comment:11 by , 6 years ago
Works like a charm - and appears to fix #2597 as well. Thanks!
This is true if you use the Window's Command Prompt application to get a shell. So this is a bug. This hasn't been noticed before as a bug because it works when one uses the cygwin.com linux environment for Windows to get a shell, which the ChimeraX team does.