473,574 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom Execution from Python

Hello all,

I have a shared object executable viz. *cable* which I execute as follows :

$ ansyscust71 -custom cable -p ANSYSRF

**ansyscust71 is a shell script and is a part of a software called ANSYS**
Now, I have generated a python module using a *fortran-python interface
generator called F2PY* using the same *make rules* which were used to make
*cable* when not using F2PY

I got a Python extension module named *cable_f2py* again.

From the python environment when I tried to execute *cable_f2py* ( thisis
python module due to F2PY), I got a segmentation error just like how I would
get this error when I execute *cable* as follows when not using F2PY:

$ ./cable
Segmentation Fault

However, when I execute it as follows, it works

$ansyscust71 -custom cable -p ANSYSRF --> This is required for succesful
execution
Now, I dont understand how I can mimic the above way of execution from within
Python to execute *cable_f2py* which as I mentioned earlier is the resultof
making and linking all the same libraries which were used while making and
linking cable

I am really confused

Can someone help me ??
Thanks in advance,

Best Regards,
Satish


--
SATISH KUMAR CHIMAKURTHI
Graduate Teaching Assistant
CFD GROUP
UNIVERSITY OF KENTUCKY
LEXINGTON
KENTUCKY - 40508
Email: sk*****@engr.uk y.edu
Mobile: 859-312-8425

Vice-President
American Institute Of Aeronautics and Astronautics
Student Chapter
University Of Kentucky

Jul 18 '05 #1
2 2887
satish wrote:

I have a shared object executable viz. *cable* which I execute as follows :
$ ansyscust71 -custom cable -p ANSYSRF

**ansyscust71 is a shell script and is a part of a software called ANSYS**

Now, I have generated a python module using a *fortran-python interface
generator called F2PY* using the same *make rules* which were used to make
*cable* when not using F2PY

I got a Python extension module named *cable_f2py* again.

From the python environment when I tried to execute *cable_f2py* ( this is
python module due to F2PY), I got a segmentation error just like how I would
get this error when I execute *cable* as follows when not using F2PY:

$ ./cable
Segmentation Fault

However, when I execute it as follows, it works

$ansyscust71 -custom cable -p ANSYSRF --> This is required for succesful
execution

Now, I dont understand how I can mimic the above way of execution from within
Python to execute *cable_f2py* which as I mentioned earlier is the result of
making and linking all the same libraries which were used while making and
linking cable

I am really confused


So are we, as most of what you describe above seems to have very little
relationship with Python. You might need to think through your problem
and attempt to explain it in a different way for us to help you. For
example, you don't show *how* you try to execute it "from the python
environment". Have you got some code to show us?

Anyway, as a bit of a long shot, are you aware of the os.system() function,
and the various other methods of running external executables? If
you are already using one of those, you might want to show us how you
use it.

-Peter
Jul 18 '05 #2
Hello peter,

Thanks for responding. I will think through my problem again and present it in
the best possible form shortly. However, in a nutshell, what I need to dois
*EXECUTE A PYTHON MODULE WITH A SHELL SCRIPT PROVIDED BY AN EXTERNAL PROGRAM,
FROM WITHIN PYTHON*

The name of the script is *ansyscust71* which is a shell script provided by a
Finite Element software called ANSYS. ANSYS provides a number of
customization features, as a part of which, it allows users to write fortran
codes using ANSYS's internal functions/methods and execute the corresponding
*shared modules* using the following command.

$ ansyscust71 -custom cable -p ANSYSRF

ANSYS EXECUTES SUCCESFULLY
However, initially when I did'nt know of the above command, I executed
*cable* as follows :

$ ./cable

ANSYS EXECUTED
Segmentation Fault

Later I did use the right command as I mentioned above, which made my module
execute succesfully.

*cable* is a shared module which I got after *making* my fortran code viz.
*ansys.F90* by linking it with *ANSYS libraries* using a *Makefile* thatI
wrote for the purpose
After this, I intended to do the same thing from python. I wrapped my fortran
code *ansys.F90* using F2PY(Fortran to Python Interface Generator), with
which many of the python users are familiar. I got a python module named
*cable_f2py* succesfully.
Sample *ansys.F90*

SUBROUTINE ansys()
cmd='START_OF_A NSYS'
ncommand=len_tr im(cmd)
where=mainan(nc ommand,cmd)
END SUBROUTINE ansys

This is just a part of *ansys.F90* which initializes ANSYS upon execution

From python I execute the module as follows :
import cable_f2py %cable is a python module generated by F2PY
cable_f2py.ansy s()

ANSYS EXECUTED
Segmentation fault

$

ANSYS gets initialized succesfully. However, I get a segmentation fault at the
end and PYTHON skips the execution from that point and transfers control to
the command prompt.

If you remember, the same thing happened when I tried to execute *cable* as
*./cable* initially when I did'nt use F2PY to generate the Python module
Precisely, this is my problem.

Does this help you to help me ??
Thanks for your time and patience in advance,

Regards,
Satish
On Friday 19 September 2003 08:04 pm, Peter Hansen wrote: satish wrote:
I have a shared object executable viz. *cable* which I execute as
follows : $ ansyscust71 -custom cable -p ANSYSRF

**ansyscust71 is a shell script and is a part of a software called
ANSYS**

Now, I have generated a python module using a *fortran-python interface
generator called F2PY* using the same *make rules* which were used to
make *cable* when not using F2PY

I got a Python extension module named *cable_f2py* again.

From the python environment when I tried to execute *cable_f2py* ( this
is python module due to F2PY), I got a segmentation error just like how I
would get this error when I execute *cable* as follows when not using
F2PY:

$ ./cable
Segmentation Fault

However, when I execute it as follows, it works

$ansyscust71 -custom cable -p ANSYSRF --> This is required for succesful
execution

Now, I dont understand how I can mimic the above way of execution from
within Python to execute *cable_f2py* which as I mentioned earlier isthe
result of making and linking all the same libraries which were used while
making and linking cable

I am really confused


So are we, as most of what you describe above seems to have very little
relationship with Python. You might need to think through your problem
and attempt to explain it in a different way for us to help you. For
example, you don't show *how* you try to execute it "from the python
environment". Have you got some code to show us?

Anyway, as a bit of a long shot, are you aware of the os.system() function,
and the various other methods of running external executables? If
you are already using one of those, you might want to show us how you
use it.

-Peter


--
SATISH KUMAR CHIMAKURTHI
Graduate Teaching Assistant
CFD GROUP
UNIVERSITY OF KENTUCKY
LEXINGTON
KENTUCKY - 40508
Email: sk*****@engr.uk y.edu
Mobile: 859-312-8425

Vice-President
American Institute Of Aeronautics and Astronautics
Student Chapter
University Of Kentucky

Jul 18 '05 #3

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

Similar topics

6
4172
by: Paolo Losi | last post by:
Hi all, I'm pretty new to the python language so please excuse me if this is FAQ... I'm very glad to be part of the list! :-) I'm looking into a way to implement a generic workflow framework with python. The basic idea is to use python scripts as the way to specify workflow behavior. The framework should not only use scripts as a...
30
2543
by: Sean R. Lynch | last post by:
I've been playing around with Zope's RestrictedPython, and I think I'm on the way to making the modifications necessary to create a capabilities-based restricted execution system. The idea is to strip out any part of RestrictedPython that's not necessary for doing capabilities and do all security using just capabilities. The basic idea...
0
1169
by: Gouda Man | last post by:
Hey everyone, I'm embedding the Python interpreter within my program to use as a scripting language. However, one of the unique features of our program is the ability of the internal language to possess per-object security permissions and restricted execution. Therefore, we need to add extra "magic members" (a la __class__, __doc__, and...
3
2399
by: Alex Stevens | last post by:
I'd already posted this in microsoft.public.dotnet.framework.windowsforms and microsoft.public.dotnet.framework.windowsforms.controls to no avail so apologies for the cross-posting. Hi, I'm writing a usercontrol which displays the typical two listboxes and the ability to move items from one to the other. The listboxes are populated...
7
15249
by: WindAndWaves | last post by:
Hi Gurus I am trying to make a custom message box with a dialog form. Here is how I would like to do it: 1- anywhere in the database, in any procedure, I call the function that opens a dialog form 2- users clicks on a button in the custom form 3- answer from user is passed back to original procedure (e.g. whether the answer was Yes or...
0
1542
by: Pavan | last post by:
My name is Pavan and I am a software engineer working on ASP .Net web development. Currently I am using .Net 2.0 Professional Edition to develop my web pages. I have a problem
2
3542
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the custom membership provider fine and removes the security question/answer fields as designated in the custom provider. The problem is that when I...
0
2104
by: Atul Thombre | last post by:
Hello, I am developing a custom membership provider. For that I built a prototype that uses a SQL Server 2005 database as a backend store. I implemented the class System.Web.Security.MembershipProvider and implemented few necessary methods. The methods use SQL for interacting with the SQL Server database. I put all this code in a class...
0
1181
by: =?utf-8?Q?Poor=20Yorick?= | last post by:
Today I needed to install python from source on linux to a custom path. /usr/lib/libtk8.3.so existed, but I wanted python to link to /my/custom/path/lib/libtk8.4.so. I had LDFLAGS set: LDFLAGS="-L/my/custom/path/lib -Wl,-rpath,$base/lib -Wl,--enable-new-dtags" configure looked like this: ../configure...
0
7826
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8126
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6491
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5637
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5328
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3763
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3781
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2257
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.