473,394 Members | 1,726 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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.uky.edu
Mobile: 859-312-8425

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

Jul 18 '05 #1
2 2872
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_ANSYS'
ncommand=len_trim(cmd)
where=mainan(ncommand,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.ansys()

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.uky.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
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...
30
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...
0
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...
3
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...
7
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...
0
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
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...
0
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...
0
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: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
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,...
0
jinu1996
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...
0
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...

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.