I am attempting to debug a misbehaving Vim plug-in that is apparently writing stuff to stdout and stderr, but since gVim seems to launch in a separate process when run from the command line, I have to way to inspect it. Is there any solution?
As it's hard to write to stdout / stderr from Vimscript, I doubt that this is what the plugin does.
In any way, hardly any plugin is GVIM-only, so you can just launch terminal Vim to capture the output.
debugging tips
To troubleshoot the misbehaving plugin, I recommend to capture a verbose log with vim -V20vimlog.
If that doesn't suffice, you can step through the plugin, e.g. with :breakadd file plugin/pluginname.vim. Finally, don't hesitate to contact the plugin's author; he's best suited to help you.
Related
I run calculations on Windows for hours and would like to have the calculation report/log inside the interactive IDLE/shell window be saved to a file at the end by a command.
Would be nice to exit() and close the window too.
As much as I like Linux, this is an Unattended Windows machine, hence, some modules/commands are not available, sadly, and the ability to install other software is limited.
The fact that the developers did not think of a command to save the transactions within the IDLE/shell is surprising.
I know in some environments you can direct the output of a job, like a report to another text file by using the key -o, --o, --output, > to a text file. Surprisingly Python does not support anything like that!
Any help would be appreciated
Thanks
Windows Command Prompt supports stdout redirection and probably stderr redirection. I just tested python -c "print(test)" > F:/dev/tem/out.txt and the print out went to out.txt. Replace -c "print('test') with script.py and the same should happen. Piping stdout of one program to stdin of another might work. You might be able to chain programs with a .bat file. PowerShell likely is more powerful and flexible, but I have never used it.
I am not completely clear on what you are asking, but I hope the following answers your questions.
Python runs in 2 modes: batch and interactive. Interactive mode is intended for ephermeral interaction with a human. Batch mode is for unattended computation, with occasional screen messages, but with most results sent to a file other than the screen. Both modes are combined when you run python -i xyz.py. The file is first run in batch mode, and then Python shifts to interactive mode.
It sounds like you should be using batch mode rather than either Python's or IDLE's interactive mode. If your code runs from IDLE, you should be able to run it directly with the same python.exe that you used to run IDLE. There are exceptions, of course, if one makes one's code dependent on running within IDLE, but this is unlikely to be an accident or to be needed for unattended running.
The IDLE Shell simulates interactive Python. When a file is run from an editor window, IDLE simulates python -i file-being-edited.py, with screen output going to Shell. In either case, an interactive user can save the contents of Shell with the File => Save As menu command. So there is such a command. There are also close window and exit commands and shortcuts.
In IDLE's intended use, as an interactive python learning and program development environment, there is no need from for a program to issue these commands. To save data in a file, a program can open a file and write data directly.
Try to see if you can install Jupyter Notebook (not separate software, but just a python module)
pip install jupyter
Jupyter notebook is highly helpful for saving and sharing your code. It can be used as both a shell and as a script editor.
Emacs command org-html-convert-region-to-html can convert org mode to html file and I have a project which is a Java program where I need handle the org mode file and convert it to html.
I want use system call to interactive with emacs daemon, which similar as execute shell command at terminal, and I could get the response from shell output stream to my program.
Can I start a emacs daemon and send the org-html-convert-region-to-html command to it which response a output html format stream in shell?
Thanks.
Emacs can be set-up to run a server. Then you could run emacsclient commands (perhaps with the -e option, to evaluate expressions)
Emacs could also be started specially to run some Elisp commands (and could be started without opening any windows).
(however, I don't think your design is a good one. You could consider parsing org files in Java instead, and that is probably more suitable in your case)
Similar to "Is there a way to see the shell commands executed by SmartGit?" is there a way to see the commands that the Tower GUI is executing on my behalf? I want to learn the git command line at the same time I'm using the GUI.
This is possible if you enable Debug Logging in the Help menu. Then open Console.app and create a System Log Query like in the screenshot below. That will list all the commands that Tower.app executes for you. Note that it passes a lot of arguments that you normally wouldn't use yourself, so Tony's advice to learn the commands still applies.
Is there any way to copy the output printed in the terminal to a file.In my case the commands 'script' , 'tee' and '>>' wont work because i already executed my program and given a large output which am not able to copy from the terminal
Got it.
There is an option in terminal->shell-> Export text As. Which resolved my issue :)
No, you can't intercept a running program's existing filehandles and transparently redirect them elsewhere. Some terminal emulators may support logging; if your terminal has enough scrollback you could copy and paste it (although be careful where you paste it to, if it's voluminous; feeding it to other terminals may result in much of it being lost when the pty buffer fills).
I'm writting a Ruby program for windows, and I need to read user input from keyboard (stdin).
However, it's needed that the user key-presses are not automatically displayed in the windows console, and behave like "silent key presses"
This problem in Ruby over linux, can be solved using the "stty" linux command:
%x{stty -icanon -echo}
because it is the linux terminal who automatically outputs the user-keys into the terminal, so running the "stty" command tells the terminal to stop showing the user-key-presses.
But my program must run in windows, so I tried searching for a "stty" equivalent command for windows console, but still found nip...
?any suggestions, pointers ?
Look at Highline gem. To clarify, look at ask method and provide a block to silence it's output. It is well exemplified in their documentation