output

Python console application - output above input line

邮差的信 提交于 2019-12-04 02:48:33
I am trying to write a console application in Python3. The problem is I would like all output messages EG: print("Status message") to be above the input line at the bottom. Status message 1 Status message 2 Status message 3 Console:> I want to type here while the output messages displayed at the moment it looks more like this Console:> want to type here while the outStatus message 1 put messages displayed Is there anyway to do this without using curses? Try this: print chr(27)+'[2AOutput' Hope this is what you are asking for. Sorry the above is for Python 2.7. I am not sure whether the Python

How to output smooth cspline curve as a data file

喜欢而已 提交于 2019-12-04 00:23:27
问题 Does anybody know how to extract some data of smooth cspline curve for a given data? For instance, there is a data file which has 2 columns corresponding to x and y values. I can draw the data with smooth cpline curve by the following commands p 'data' w lp, "" smooth csplines I want to extract the smooth cpline curve as an another data file. 回答1: This can be done by setting a table . Consider the following data file: 0 1 1 2 2 3 3 2 4 2 5 4 6 8 7 5 8 3 9 1 The data itself and its csplines

suppress scapy warning message when importing the module

扶醉桌前 提交于 2019-12-04 00:17:38
I'm writing a small script, that gathers some information using scapy and then returns some xml code, that I'll pass on to the xmlrpc interface of metasploit. I'd like it that my script only returns xml, and no additional warnings etc. I can suppress most scapy output, with adding the option verbose=0 to my sr1 command. What I still get before every output, and I assume it returns this warning when I'm loading the module, is: WARNING: No route found for IPv6 destination :: (no default route?) I can easily redirect that output, by calling my script like this: ./myscript 2> /dev/null but I'd

OpenCV documentation says that “uchar” is “unsigned integer” datatype. How?

爱⌒轻易说出口 提交于 2019-12-03 21:47:22
问题 I got confused with the openCV documentation mentioned here. As per the documentation, if i create an image with "uchar" , the pixels of that image can store unsigned integer values but if i create an image using the following code: Mat image; image = imread("someImage.jpg" , 0); // Read an image in "UCHAR" form or by doing image.create(10, 10, CV_8UC1); for(int i=0; i<image.rows; i++) { for(int j=o; j<image.cols; j++) { image.at<uchar>(i,j) = (uchar)255; } } and then if i try to print the

Parallel output using MPI IO to a single file

旧街凉风 提交于 2019-12-03 17:30:30
I have a very simple task to do, but somehow I am still stuck. I have one BIG data file ("File_initial.dat"), which should be read by all nodes on the cluster (using MPI), each node will perform some manipulation on part of this BIG file (File_size / number_of_nodes) and finally each node will write its result to one shared BIG file ("File_final.dat"). The number of elements of files remain the same. By googling I understood, that it is much better to write data file as a binary file (I have only decimal numbers in this file) and not as *.txt" file. Since no human will read this file, but only

Multiple output path (Java - Hadoop - MapReduce)

北城以北 提交于 2019-12-03 17:11:34
I do two MapReduce job, and I want for the second job to be able to write my result into two different files, in two different directories. I would like something similar to FileInputFormat.addInputPath(.., multiple input path) in a sense, but for the output. I'm completely new to MapReduce, and I have a specificity to write my code in Hadoop 0.21.0 I use context.write(..) in my Reduce step, but I don't see how to control multiple output paths... Thanks for your time ! My reduceCode from my first job, to show you I only know how to output (it goes into a /../part* file. But now what I would

Python: How to read stdout of subprocess in a nonblocking way

孤人 提交于 2019-12-03 15:22:51
I am trying to make a simple python script that starts a subprocess and monitors its standard output. Here is a snippet from the code: process = subprocess.Popen([path_to_exe, os.path.join(temp_dir,temp_file)], stdout=subprocess.PIPE) while True: output=process.stdout.readline() print "test" The problem is that the script hangs on output=process.stdout.readline() and that the line print "test" only executes after the subprocess is terminated. Is there a way to read standard output and print it without having to wait for the subprocess to terminate? The subprocess which I am starting is a

How to show output in console when writing an RMarkdown notebook?

谁都会走 提交于 2019-12-03 15:09:54
问题 I have a simple question, and I think I'm just not looking in the right place, or RStudio is not acting as expected. I'd like to know if there is an option to output the results of all my markdown code chunks to go to the plots window or the console. I'm starting to use R Notebooks to write in R Markdown. Say I type the command head(cars) into my .Rmd document. I press Ctrl + Enter, and the line is run. Up pops the first 6 lines of the cars dataframe into my script. I see that the line has

Capture output from git command?

核能气质少年 提交于 2019-12-03 13:26:34
I am writing a script to automate setting up new projects for me. this includes pulling down a github repository. What I want to do is have some output from my script, then call git clone $repo I want to show the output from that command while it is running, but then when it has run if it has run successfully replace it's output (note just the git commands output, I still want the output from before that to be there) with repository successfully cloned and if failed just leave the output there, and print repository cloning failed . How can I do this? Below is my current (rather simple) script.

How to save output from python like tsv

梦想与她 提交于 2019-12-03 12:33:38
I am using biopython package and I would like to save result like tsv file. This output from print to tsv. for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"): print ("%s %s %s" % (record.id,record.seq, record.format("qual"))) Thank you. That is fairly simple , instead of printing it you need to write that to a file. with open("records.tsv", "w") as record_file: for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"): record_file.write("%s %s %s\n" % (record.id,record.seq, record.format("qual"))) And if you want to name the various columns in the file