Hello guys,
I'm trying to open a .exe file and insert multiple inputs.
the problem is that when I open the file it requests each input at a time, like thin
(starting program in the prompt mode of windows)
insert input 01: ##(here I should insert an input and ##press enter if I were using the program in the prompt ##mode)
insert input 02: ##(here I should insert the second ##input and press enter if I were using the program in ##the prompt mode)
the first input is a file that has all data that the program need to calculate;
the second file has the outputs of the file.
Is there anyway that I could manage this file using python?
6 2726
This depends a little bit on whether the .exe has some ability to handle the inputs differently.
Eg, can you run the exe by typing at the prompt:
or similar. If so, then you can easily do it with python.
If in insists on a manual input then you may need something else. If you're using linux X11 could do the job.
Unfortunately I can't do that. The program calls each input at a time.
like, using the program at the cmd prompt of windows:
(starting the program in prompt of windows) give the input file: (then we type the input file and press enter) give the output file: (we type the output file and press enter)
've already tried to do so using the
os.system('program < input n/ output')
but this didn't work very well. I've tried also the "commands" and nothing also worked. I've even tried the subprocess.Popen, but I didn't find the way to do this working.
I hope you can help-me
Thanks a lot,
Álvaro
Where did this exe file come from? It may be easier to fix it!
However, X11 is a great programme and easy to use to simulate mouse and key board input. You can, therefore, set it up to simulate entering the data. People have used it, as a funny example, to click all their fields in farmville automatically! However, this is a linux thing, so may not suit you. I'm not sure if there is a PC equivalent/version.
The trouble is that if python runs the .exe through it's command then it essentially loses control (with the .exe taking over) while waiting for user input.
I'd be interested to hear how you get on.
Are you really sure that you can't enter the files on the first command line - this is the standard way around this problem. Can you check the documentation of the exe file.
Hello!
This program is a vortex lates method used to provide some aerodynamic characteristics of a wing that we define in the input file of the program.
It has been developed by Professor Vasco Brederode (a Portuguese aerodynamicist) and given to us by our professor Soviero to develop a study over a combination of wings.
The way to solve the exercise we managed, but I'm really interested to know how could I do this thing. It's a really important thing to us as engineers.
Is there any way that I could send you the files and you see how does the program looks like?
Thanks a lot,
Álvaro
Hi Alvaro
It is better to keep the discussion public. You're welcome to post your code though.
Regarding the vortex lattice program, do you have the source code? Or can you get it. Depends on the language that it's in, but it should be a very trivial edit to make it work with inputs on the command line. It's probably Fortran or C++.
There's a book called Python Scripting for Computational Science which I'd recommend for this kind of thing. It has a section on running Fortran scripts from python (which is an ideal mix in many ways because the Fortran or C++ or whatever does the heavy lifting and the python does the file handling, graphing etc).
I'll put this question to some of the other experts, but I really think editing the original .exe (or finding out how to use it) is the way to go.
os.system('program < input n/ output')
This wouldn't work because the "<" operator on the commandline is made for input from files, not strings.
You could try writing input and output to a file and then use that file to run the program with.
Something like this: - f = open('temp', 'w')
-
f.write('input\n')
-
f.write('output\n')
-
f.close()
-
os.system('program < temp')
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Elizabeth Gary |
last post by:
How can I enter in multiple input lines to an array? Example:
Enter your mailing address:
7660 Eyespy Court
Clinton, Mississippi 32322
When I try to do this perl just sits and waits for...
|
by: Eliezer Figueroa |
last post by:
Managing Multiple Excel incoming files?
I have this situation. I have a client which have several locations they
work primary with excel forms and they are thinking in doing reports with
them....
|
by: Cliff Williams |
last post by:
How are people managing multiple, interdependent projects in the same
solution? If I have to rebuild my solution file one more time, I think
my head is going to spin around and pop off.
I've...
|
by: paczkow |
last post by:
Dear Python Community,
I am an engineering and I am experiencing some trouble. Having output
data from other software I want to use it. To achieve this I decided to
use Python since this...
|
by: jwright |
last post by:
I have decided to use a struct to collect my data. The input file is
comma dilineated between almost all of the fields. Here is the code I
have so far and a sample input and output file.
...
|
by: srikar |
last post by:
Hi all,
I am having a problem, when I am compiling the code in 32 bit option on a
64 bit machine using the macro CPPFLAGS= -m32 I am getting the following warnings from
the linker .
...
|
by: max.giacometti |
last post by:
Hi everybody!
I am using lex and yacc to write a vhdl to systemc converter.
Lex simply reads the input file and yacc implements grammar and
translation.
I'd like to be able to make yacc...
|
by: ezechiel |
last post by:
hi everyone..
i read on another forum that it is possible to define multiple input masks for a textbox (for example).
There is a textbox field where you can enter the name of a machine.
The...
|
by: Lucky Beniwal |
last post by:
I need to write a function parse_in with the following prototype :
int parse_in(FILE *f, int *cost){
/* parse the input file and fill in const array
* Need to return the number of cities read...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |