473,326 Members | 2,126 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,326 software developers and data experts.

Having lots of fun passing parameters ... help!

DAC
I've defined a single method in Python using:

def funcAdjacents(inputWord, outputFile):
...
lots of boring stuff
...
and then called it using:

funcAdjacents("SampleWord","outputFile.file")

Which works OK in Python - I get the results I want. But what I'm
trying to do is get inputWord and outputFile to be parameters are
passed on the command line, e.g.

C:\Python\ myScript.py "SampleWord" "outputFile.file"

And just to add to the fun, once I've reached this stage I would like
to either a) be able to execute this .py file from a HTML environment
or b) execute this file as a .exe and embed into HTML (which I can
do).

Has anyone got any ideas?

DAC.

Jun 18 '07 #1
2 1217
DAC wrote:
I've defined a single method in Python using:

def funcAdjacents(inputWord, outputFile):
...
lots of boring stuff
...
and then called it using:

funcAdjacents("SampleWord","outputFile.file")

Which works OK in Python - I get the results I want. But what I'm
trying to do is get inputWord and outputFile to be parameters are
passed on the command line, e.g.

C:\Python\ myScript.py "SampleWord" "outputFile.file"

And just to add to the fun, once I've reached this stage I would like
to either a) be able to execute this .py file from a HTML environment
or b) execute this file as a .exe and embed into HTML (which I can
do).
You get the parameters to a script executed at the shell using

import sys
print sys.argv

or in your case

funcAdjacents(*sys.argv[1:])

Executing this from HTML requires the usage of CGI. But without further
details what you really are after here and what your webenvironment is, we
won't be able to help you.

Diez
Jun 18 '07 #2
DAC
On 18 Jun, 14:57, "Diez B. Roggisch" <d...@nospam.web.dewrote:
DAC wrote:
I've defined a single method in Python using:
def funcAdjacents(inputWord, outputFile):
...
lots of boring stuff
...
and then called it using:
funcAdjacents("SampleWord","outputFile.file")
Which works OK in Python - I get the results I want. But what I'm
trying to do is get inputWord and outputFile to be parameters are
passed on the command line, e.g.
C:\Python\ myScript.py "SampleWord" "outputFile.file"
And just to add to the fun, once I've reached this stage I would like
to either a) be able to execute this .py file from a HTML environment
or b) execute this file as a .exe and embed into HTML (which I can
do).

You get the parameters to a script executed at the shell using

import sys
print sys.argv

or in your case

funcAdjacents(*sys.argv[1:])

Executing this from HTML requires the usage of CGI. But without further
details what you really are after here and what your webenvironment is, we
won't be able to help you.

Diez- Hide quoted text -

- Show quoted text -
Thanks Diez, I understand what you mean. I'm fine with the CGI aspect
of things, it was just getting those parameters across which was
difficult.

DAC.
Jun 18 '07 #3

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

Similar topics

12
by: Joel | last post by:
Hi all, Forgive me if I've expressed the subject line ill. What I'm trying to do is to call a c++ function given the following: a. A function name. This would be used to fetch a list of...
7
by: Harolds | last post by:
The code below worked in VS 2003 & dotnet framework 1.1 but now in VS 2005 the pmID is evaluated to "" instead of what the value is set to: .... xmlItems.Document = pmXML // Add the pmID...
2
by: Bob | last post by:
I'm new to Access projects and SQL server and am not a veteran VB programmer. There's a cry for help! I'm attempting to print the current form on screen by using a command button which the user...
39
by: Mike MacSween | last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime ago. Then remembered that arguments are passed by reference, by default. Does the fact that this slowed me down...
17
by: Charles Sullivan | last post by:
The library function 'qsort' is declared thus: void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)); If in my code I write: int cmp_fcn(...); int...
8
by: Johnny | last post by:
I'm a rookie at C# and OO so please don't laugh! I have a form (fclsTaxCalculator) that contains a text box (tboxZipCode) containing a zip code. The user can enter a zip code in the text box and...
10
by: amazon | last post by:
Our vender provided us a web service: 1xyztest.xsd file... ------------------------------------ postEvent PostEventRequest ------------------------------------- authetication authentication...
2
by: Hakan Örnek | last post by:
Hi , I want to parameter passing to my windows sevice. I call service commands like this ; '------------------------------------------------------------ Dim sc As ServiceController sc = New...
4
by: softwaregeek | last post by:
hi to all, I am having some problem in passing parameter..... My code looks like::: request.setAttribute("game",game);...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.