473,473 Members | 1,672 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

OS.SYSTEM ERROR !!!

To All,
I have been attempting to execute the following program within the
Python environment:

Myprogram.exe, which means this is an executable file!!

I would usually execute this program (with the appropriate arguments) by
going to following directory within MS-DOS (Windows XP):

C:\myprogramfolder\runMyprogram.exe 1 1 acc 0
The executable would execute perfectly.
However, when I would try to execute the following lines of source code
within a python script file:

import os

os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0")
The executable file would start to execute until it would print an error
stating that it cannot use a (.dat) file, which is located under the
following directory:
C:\myprogramfolder\run\inputs\io\control.dat
I believe I may be missing something here that prevents the executable
file working within python from utilizing this (.dat). The printed
final error is the following:

ERROR opening inputs/io/control.dat

Does anyone know what that could be ??
Thanks,
David Blubaugh

This e-mail transmission contains information that is confidential and may be
privileged. It is intended only for the addressee(s) named above. If you receive
this e-mail in error, please do not read, copy or disseminate it in any manner.
If you are not the intended recipient, any disclosure, copying, distribution or
use of the contents of this information is prohibited. Please reply to the
message immediately by informing the sender that the message was misdirected.
After replying, please erase it from your computer system. Your assistance in
correcting this error is appreciated.

Sep 30 '08 #1
3 1334
Blubaugh, David A. wrote:
To All,
I have been attempting to execute the following program within the
Python environment:

Myprogram.exe, which means this is an executable file!!

I would usually execute this program (with the appropriate arguments) by
going to following directory within MS-DOS (Windows XP):

C:\myprogramfolder\runMyprogram.exe 1 1 acc 0
The executable would execute perfectly.
However, when I would try to execute the following lines of source code
within a python script file:

import os

os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0")
The executable file would start to execute until it would print an error
stating that it cannot use a (.dat) file, which is located under the
following directory:
C:\myprogramfolder\run\inputs\io\control.dat
I believe I may be missing something here that prevents the executable
file working within python from utilizing this (.dat). The printed
final error is the following:

ERROR opening inputs/io/control.dat

Does anyone know what that could be ??
The program (myprogram.exe) is not looking for
C:\myprogramfolder\run\inputs\io\control.dat, it's looking for
inputs/io/control.dat relative to its current working directory. That
will only work if the current working directory of the program is
C:\myprogramfolder\run. Is it?

--
Carsten Haese
http://informixdb.sourceforge.net
Sep 30 '08 #2
On Sep 30, 1:21*pm, "Blubaugh, David A." <dbluba...@belcan.comwrote:
I would usually execute this program (with the appropriate arguments) by
going to following directory within MS-DOS (Windows XP):

C:\myprogramfolder\runMyprogram.exe 1 1 acc 0
[snip]
import os

os.system(r"C:\myprogramfolder\run\Myprogram.exe 1 1 acc 0")
[snip]
ERROR opening inputs/io/control.dat
[snip]

I would add the following line right before your call to os.system:

os.chdir(r'C:\myprogramfolder\run')

If you have to change directories to run it properly in the Windows
shell, then you need to do it in Python, too.

HTH,
Geoff G-T

Sep 30 '08 #3
gi****@gmail.com wrote:
I would add the following line right before your call to os.system:

os.chdir(r'C:\myprogramfolder\run')
I wouldn't. os.chdir() tends to introduce all sorts of trouble. It's a
quick n'dirty hack for a small script but no solution for a large
program or library.

Christian

Sep 30 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve...
0
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
2
by: Kirk | last post by:
I'm trying to use a Web Service to be a Remoting client of an existing ..NET 2.0 server. But I get the following error when I try to use System.Runtime.Remoting.Channels.Http in my WebService. ...
0
by: nicomp | last post by:
I created a Web Service: I imported System.Data.SqlClient so I could access SQL server tables programmatically. The web service builds and deploys with no problems. When I try to add the...
2
by: BruceWho | last post by:
I downloaded boost1.35.0 and built it with following command: bjam --toolset=msvc-7.1 --variant=release --threading=multi -- link=shared --with-system stage and it failed to compile, error...
0
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
1
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...
0
agi2029
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.