473,549 Members | 2,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

adding python scripting to my application

Hi, first of all, I have to say I am new to Python. I have been working
with a finite element analysis program written in c++. now, I am trying
to 'rebuild' this code (possibly a full re-write) with scripting
capability. I did some reading on the web, and found that there are two
ways to do this : extending and embedding. and I still haven't figured
out what I should be using. I guess the first thing is to figure out
what I am to do with the scripting capability - at the very least, I
would like to run parametric analyses - run multiple analysis models by
changing certain parameters using for loops.
i found that the commercial fea package - abaqus uses python as well -
I don't know whether they embedded or extended ? is there any way to
find out?
another fea application called OOF2
(http://www.ctcms.nist.gov/oof/oof2/#features) says "OOF2 is completely
scriptable in Python". and I don't really understand what that means...
maybe I haven't grasped the full potential of what python scripting
could do for an fea program.

can you tell me how to decide what path I should take - embed or extend
? or maybe some one could point me to some document/webpage that talks
about this.

thanks a lot,
Julian.

PS, my fea program uses its own script to read the analysis model
information using the c++ iostream and our own parsing functions - but
I don't have to stick to those function when I am writing the new code.

Nov 6 '06 #1
4 2117
I am not a Python guru by any means, but I believe that when an
application says that you can "script" their application with Python,
it means that you can actually write Python code to interact with the
application. Embedding may be the same thing. Extending (as I read
it) involves writing portions of your program in Python and have do the
logic portions.

If you would like to allow users to write small scripts that interact
with your program and control it (a la VBScript or AppleScript), then I
believe embedding Python in your program is what you want.

If you would like Python to run various parts of your program in order
to make some portions easier to write/manage/whatever, then you want to
"extend" your program using Python.

The key difference being that you aren't providing a way for someone
else to interact with your program using Python if you are extending.

Again, I am not a guru and a read through the docs on python.org would
probably be the best place to get sound technical advice on these
subjects.

--
Jerry

Nov 6 '06 #2
Jerry wrote:
I am not a Python guru by any means, but I believe that when an
application says that you can "script" their application with Python,
it means that you can actually write Python code to interact with the
application. Embedding may be the same thing. Extending (as I read
it) involves writing portions of your program in Python and have do the
logic portions.

If you would like to allow users to write small scripts that interact
with your program and control it (a la VBScript or AppleScript), then I
believe embedding Python in your program is what you want.

If you would like Python to run various parts of your program in order
to make some portions easier to write/manage/whatever, then you want to
"extend" your program using Python.

The key difference being that you aren't providing a way for someone
else to interact with your program using Python if you are extending.

Again, I am not a guru and a read through the docs on python.org would
probably be the best place to get sound technical advice on these
subjects.

--
Jerry

I'm not sure either, but I though Extending was making the C/C++ Code
available from Python, while Embedding was making Python Code Available
in your app.

Nov 6 '06 #3
Take a look at:

http://www.swig.org/

Julian wrote:
Hi, first of all, I have to say I am new to Python. I have been working
with a finite element analysis program written in c++. now, I am trying
to 'rebuild' this code (possibly a full re-write) with scripting
capability. I did some reading on the web, and found that there are two
ways to do this : extending and embedding. and I still haven't figured
out what I should be using. I guess the first thing is to figure out
what I am to do with the scripting capability - at the very least, I
would like to run parametric analyses - run multiple analysis models by
changing certain parameters using for loops.
i found that the commercial fea package - abaqus uses python as well -
I don't know whether they embedded or extended ? is there any way to
find out?
another fea application called OOF2
(http://www.ctcms.nist.gov/oof/oof2/#features) says "OOF2 is completely
scriptable in Python". and I don't really understand what that means...
maybe I haven't grasped the full potential of what python scripting
could do for an fea program.

can you tell me how to decide what path I should take - embed or extend
? or maybe some one could point me to some document/webpage that talks
about this.

thanks a lot,
Julian.

PS, my fea program uses its own script to read the analysis model
information using the c++ iostream and our own parsing functions - but
I don't have to stick to those function when I am writing the new code.
Nov 6 '06 #4

"martdi" <ma*********@gm ail.comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Jerry wrote:
>I am not a Python guru by any means, but I believe that when an
application says that you can "script" their application with Python,
it means that you can actually write Python code to interact with the
application. Embedding may be the same thing. Extending (as I read
it) involves writing portions of your program in Python and have do the
logic portions.

If you would like to allow users to write small scripts that interact
with your program and control it (a la VBScript or AppleScript), then I
believe embedding Python in your program is what you want.

If you would like Python to run various parts of your program in order
to make some portions easier to write/manage/whatever, then you want to
"extend" your program using Python.

The key difference being that you aren't providing a way for someone
else to interact with your program using Python if you are extending.

Again, I am not a guru and a read through the docs on python.org would
probably be the best place to get sound technical advice on these
subjects.

--
Jerry


I'm not sure either, but I though Extending was making the C/C++ Code
available from Python, while Embedding was making Python Code Available
in your app.
Like I mentioned in my first post, one of the purposes of linking to python
would be to run multiple cases in a for loop.
that would mean passing information from the python script to my c++
application. mean python would have to be the top-level program.
so, I think I should be looking at extending my program. I am going to look
at using swig for this..

thanks,
Julian.
Nov 13 '06 #5

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

Similar topics

4
3770
by: The_Incubator | last post by:
As the subject suggests, I am interested in using Python as a scripting language for a game that is primarily implemented in C++, and I am also interested in using generators in those scripts... Initially I was justing looking at using Python for some event scripting. So basically an event would trigger an object to run the appropriate...
2
2854
by: Roose | last post by:
With some googling I have found these resources: http://docs.python.org/ext/win-dlls.html http://www.python.org/doc/faq/windows.html I have a large Win32/MFC/C/C++ application that has an embedded scripting language (a very limited one). I would like to rip it out and replace it with Python. I am thinking that this would be relatively...
33
2695
by: Quest Master | last post by:
I am interested in developing an application where the user has an ample amount of power to customize the application to their needs, and I feel this would best be accomplished if a scripting language was available. However, I want to code this application in Python, and I have not yet heard of an implementation of another scripting language...
217
8995
by: gyromagnetic | last post by:
The following url points to an article written by Damian Conway entitled "Ten Essential Development Practices": http://www.perl.com/pub/a/2005/07/14/bestpractices.html Althought the article has Perl as a focus, I thought that some of the general points made might be of interest to the Python community. It would certainly be interesting to...
6
3564
by: Wolfgang Keller | last post by:
Hello, I'm looking for a spreadsheet application (MacOS X prefered, but Windows, Linux ar available as well) with support for Python scripting (third-party "plug-ins" are ok) and a database interface. Applications that I know of (that they exist) are: MS Excel Quattro
18
3120
by: qwweeeit | last post by:
Hi all, when I moved from Windows to Linux I choosed Python as my language of reference and as GUI, Qt (not much investigated up to now). Till now I didn't regret but one thing: Python can't act as a macro language and so you are obliged to revert to Windows to use programs like AutoIt, Macro Express or Macro Scheduler or even the macro...
118
6620
by: 63q2o4i02 | last post by:
Hi, I've been thinking about Python vs. Lisp. I've been learning Python the past few months and like it very much. A few years ago I had an AI class where we had to use Lisp, and I absolutely hated it, having learned C++ a few years prior. They didn't teach Lisp at all and instead expected us to learn on our own. I wasn't aware I had to...
2
2280
by: robert | last post by:
When employing complex UI libs (wx, win32ui, ..) and other extension libs, nice "only Python stack traces" remain a myth. Currently I'm hunting again a rare C-level crash bug of a Python based Windows app with rare user reports - and still in the dark (I get snippets of machine stack traces / screenshots with random "mem. access error" /...
17
12444
by: chewie54 | last post by:
Hello, As an electronics engineer I use some very expensive EDA CAD tool programs that are scriptable using Tcl. I was wondering why these companies have choose to use Tcl instead of Python. Some of these are: Mentor Graphics ModelTech VHDL and Verilog simulator Synopsys Design Compiler and Primetime Static Timing Analyzer Actel...
0
7518
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
7446
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7808
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...
1
5368
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
5087
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...
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.