Re: Passing arguments to & executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2017-06-09 Thread niteesh . k80
hey did you find the answer for this -- https://mail.python.org/mailman/listinfo/python-list

Re: multiprocess passing arguments double asterisks

2016-10-27 Thread ricemom
On Wednesday, October 26, 2016 at 5:31:18 PM UTC-5, MRAB wrote: > On 2016-10-26 21:44, pic8...@gmail.com wrote: > > On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote: > >> On 10/24/2016 12:45 PM, pic8...@gmail.com wrote: > >> > Thanks for the reply. > >> > > >> > The code

Re: multiprocess passing arguments double asterisks

2016-10-26 Thread MRAB
On 2016-10-26 21:44, pic8...@gmail.com wrote: On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote: On 10/24/2016 12:45 PM, pic8...@gmail.com wrote: > Thanks for the reply. > > The code snippet given by Peter is not very clear > > I would like to multiprocess a function which

Re: multiprocess passing arguments double asterisks

2016-10-26 Thread pic8690
On Monday, October 24, 2016 at 12:39:47 PM UTC-5, Thomas Nyberg wrote: > On 10/24/2016 12:45 PM, pic8...@gmail.com wrote: > > Thanks for the reply. > > > > The code snippet given by Peter is not very clear > > > > I would like to multiprocess a function which is written in python of the > > form

Re: multiprocess passing arguments double asterisks

2016-10-24 Thread Thomas Nyberg
On 10/24/2016 12:45 PM, pic8...@gmail.com wrote: Thanks for the reply. The code snippet given by Peter is not very clear I would like to multiprocess a function which is written in python of the form bar(**kwargs) which returns a value. This example does not return anything Would you please

Re: multiprocess passing arguments double asterisks

2016-10-24 Thread pic8690
On Sunday, October 23, 2016 at 3:44:16 PM UTC-5, Thomas Nyberg wrote: > On 10/23/2016 03:12 AM, pic8...@gmail.com wrote: > > import multiprocessing as mp > > > > def bar(**kwargs): > >for a in kwargs: > > print a,kwargs[a] > > > > arguments={'name':'Joe','age':20} > >

Re: multiprocess passing arguments double asterisks

2016-10-23 Thread Thomas Nyberg
On 10/23/2016 03:12 AM, pic8...@gmail.com wrote: import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() What are you trying to do? The map method is similar

multiprocess passing arguments double asterisks

2016-10-23 Thread pic8690
import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() Errors: Traceback (most recent call last): File "post.py", line 9, in p.map(bar,**arguments)

multiprocess passing arguments double asterisks

2016-10-23 Thread pic8690
import multiprocessing as mp def bar(**kwargs): for a in kwargs: print a,kwargs[a] arguments={'name':'Joe','age':20} p=mp.Pool(processes=4) p.map(bar,**arguments) p.close() p.join() Errors: Traceback (most recent call last): File "post.py", line 9, in p.map(bar,**arguments)

Calling python script in dos and passing arguments

2013-04-16 Thread PEnergy
Greetings, I am trying to write a python script that, when called from the DOS prompt, will call another python script and pass it input variables. My current code will open the other python script but doesn't seem to pass it any values: import os,sys,subprocess

Re: Calling python script in dos and passing arguments

2013-04-16 Thread Chris Rebert
On Tue, Apr 16, 2013 at 7:14 AM, PEnergy prqu...@gmail.com wrote: Greetings, I am trying to write a python script that, when called from the DOS prompt, will call another python script and pass it input variables. My current code will open the other python script but doesn't seem to pass

Re: Calling python script in dos and passing arguments

2013-04-16 Thread Alister
On Tue, 16 Apr 2013 12:10:09 -0700, Chris Rebert wrote: On Tue, Apr 16, 2013 at 7:14 AM, PEnergy prqu...@gmail.com wrote: Greetings, I am trying to write a python script that, when called from the DOS prompt, will call another python script and pass it input variables. My current code will

Re: Calling python script in dos and passing arguments

2013-04-16 Thread Michael Torrie
On 04/16/2013 08:14 AM, PEnergy wrote: Greetings, I am trying to write a python script that, when called from the DOS prompt, will call another python script and pass it input variables. My current code will open the other python script but doesn't seem to pass it any values: import

Re: Calling python script in dos and passing arguments

2013-04-16 Thread Tim Roberts
Chris Rebert c...@rebertia.com wrote: 2. Glob/wildcard (*) expansion is done by the shell, but subprocess.Popen does not use the shell by default (for good reason!). This is only true in Linux. In Windows, the wildcard characters are passed to the program, so each app must do its own glob

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine

2012-09-20 Thread ashish
On Thursday, September 20, 2012 10:39:28 AM UTC+5:30, Chris Angelico wrote: On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote: 2. I have a python script, local.py, running on local which

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Emile van Sebille
On 9/19/2012 12:50 PM ashish said... Hi c.l.p folks Here is my situation 1. I have two machines. Lets call them 'local' 'remote'. Both run ubuntu both have python installed 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments,

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Chris Rebert
On Wed, Sep 19, 2012 at 12:50 PM, ashish ashish.mak...@gmail.com wrote: snip 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to a python script, remote.py running on 'remote' (the remote

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Piet van Oostrum
Ismael Farfán sulfur...@gmail.com writes: How about something like this: os.system ( 'ssh remoteuser@remote python remote.py arg 1 arg 2 arg 3' ) That won't work. You need an additional level of quoting because ssh is also a shell so it adds another level of interpretation. The following

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-20 Thread Piet van Oostrum
Chris Rebert c...@rebertia.com writes: Use the `subprocess` module instead (with shell=False). You then won't need to worry about escaping. http://docs.python.org/library/subprocess.html You will still need to worry about escaping because on the remote end you invoke ssh which is a shell. The

Passing arguments to executing, a python script on a remote machine from a python script on local machine

2012-09-19 Thread ashish
Hi PyTutor Folks Here is my situation 1. I have two machines. Lets call them local remote. Both run ubuntu both have python installed 2. I have a python script, local.py, running on local which needs to pass arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to a

Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-19 Thread ashish
Hi c.l.p folks Here is my situation 1. I have two machines. Lets call them 'local' 'remote'. Both run ubuntu both have python installed 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments, containing whitespaces like spaces, etc ) to

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-19 Thread Ismael Farfán
2012/9/19 ashish ashish.mak...@gmail.com: Hi c.l.p folks Here is my situation 1. I have two machines. Lets call them 'local' 'remote'. Both run ubuntu both have python installed 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine (using ssh ?)

2012-09-19 Thread Tim Roberts
ashish ashish.mak...@gmail.com wrote: Here is my situation 1. I have two machines. Lets call them 'local' 'remote'. Both run ubuntu both have python installed 2. I have a python script, local.py, running on 'local' which needs to pass arguments ( 3/4 string arguments, containing whitespaces

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine

2012-09-19 Thread Steven D'Aprano
On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote: Hi PyTutor Folks Here is my situation 1. I have two machines. Lets call them local remote. Both run ubuntu both have python installed 2. I have a python script, local.py, running on local which needs to pass arguments ( 3/4 string

Re: Passing arguments to executing, a python script on a remote machine from a python script on local machine

2012-09-19 Thread Chris Angelico
On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 19 Sep 2012 12:46:33 -0700, ashish wrote: 2. I have a python script, local.py, running on local which needs to pass arguments ( 3/4 string arguments, containing whitespaces like spaces, etc )

PyQt4 QThread - passing arguments to thread methods

2010-05-27 Thread nganon tj
Hi, I am trying to figure out how to implement a QThread class that will handle GUI event while keeping the GUI responsive. I want to call thread's methods by their names and start() the thread from inside that method. My problem is with passing methods their arguments since start() wont take

passing arguments from a python program to other while executing it with exec() or spawn() in LINUX

2008-10-16 Thread gaurav kashyap
HI all, i have two python programs as 1.py and 2.py 1.py import os import sys processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/ mywork/2.py ' + 'hi') 2.py import sys domain= str(sys.argv[1] ) print domain IN LINUX while executing 1.py,the argument 'hi' is not passed to the 2.py

Re: passing arguments from a python program to other while executing it with exec() or spawn() in LINUX

2008-10-16 Thread Peter Otten
gaurav kashyap wrote: HI all, i have two python programs as 1.py and 2.py 1.py import os import sys processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/ mywork/2.py ' + 'hi') 2.py import sys domain= str(sys.argv[1] ) print domain IN LINUX while executing 1.py,the

Re: passing arguments from a python program to other while executing it with exec() or spawn() in LINUX

2008-10-16 Thread gaurav kashyap
Thanks for the help Peter.Its working fine now -- http://mail.python.org/mailman/listinfo/python-list

passing arguments to exec

2008-08-25 Thread Alexandru Mosoi
i want to execute a python script using exec open('script.py'). how do I pass arguments? -- http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments to exec

2008-08-25 Thread Wojtek Walczak
On Mon, 25 Aug 2008 06:31:53 -0700 (PDT), Alexandru Mosoi wrote: i want to execute a python script using exec open('script.py'). how do I pass arguments? Take a look at subprocess module. It comes with a set of examples. -- Regards, Wojtek Walczak, http://tosh.pl/gminick/ --

Re: Passing arguments to subclasses

2008-06-24 Thread Michael Mabin
But if you couldn't find readily available confirmation of what you presumed to be true, weren't the responses showing how you might come that answer using the interpreter helpful, rather than harsh? The Python interpreter is the shizzit. On Mon, Jun 23, 2008 at 12:17 PM, John Dann [EMAIL

Passing arguments to subclasses

2008-06-23 Thread John Dann
May I ask a simple newbie question, which I presume is true, but for which I can't readily find confirmation: Let's say I have a parent class with an __init__ method explicitly defined: class ParentClass(object): def __init__(self, keyword1, keyword2): etc and I subclass

Re: Passing arguments to subclasses

2008-06-23 Thread Bruno Desthuilliers
John Dann a écrit : May I ask a simple newbie question, which I presume is true, but for which I can't readily find confirmation: Let's say I have a parent class with an __init__ method explicitly defined: class ParentClass(object): def __init__(self, keyword1, keyword2):

Re: Passing arguments to subclasses

2008-06-23 Thread Gary Herron
John Dann wrote: May I ask a simple newbie question, which I presume is true, but for which I can't readily find confirmation: Let's say I have a parent class with an __init__ method explicitly defined: class ParentClass(object): def __init__(self, keyword1, keyword2):

Re: Passing arguments to subclasses

2008-06-23 Thread John Dann
Thanks for the responses - they're much appreciated. And I understand the slight impatience with questions that could possibly be answered without recourse to a forum - I'm usually in the opposite position of fielding many newbie questions in a forum in a completely different field! But don't be

Re: Passing arguments to subclasses

2008-06-23 Thread Scott David Daniels
John Dann wrote: ... the answer might have been of the 'yes, but' kind. Well, if you really care, there is a 'yes, but' answer, but it only has to do with multiple inheritance, and hence is a bit esoteric for the issues you are currently addressing. This is not meant to be a tease; I think it

Re: Passing arguments to exe

2007-12-18 Thread kyosohma
On Dec 15, 6:46 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Fri, 14 Dec 2007 16:38:28 -0800 (PST), [EMAIL PROTECTED] declaimed the following in comp.lang.python: The executable runs, but no argument appears to get passed into it. Of course, I don't really know that for sure as the

Re: Passing arguments to exe

2007-12-15 Thread kyosohma
On Dec 14, 8:06 pm, John Machin [EMAIL PROTECTED] wrote: snipped The executable runs, how do you know it runs? because the program's GUI appears on-screen. but no argument appears to get passed into it. appears?? Since the TO field doesn't get populated with the email address, it

Passing arguments to exe

2007-12-14 Thread kyosohma
I have created what amounts to a simple GUI email sending program using Python + wxPython. I have modified the mailto registration in the Windows Registry so that it launches the script when someone clicks on someone's email link in a web page. While this works great if I create a convoluted path

Re: Passing arguments to exe

2007-12-14 Thread John Machin
On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote: I have created what amounts to a simple GUI email sending program using Python + wxPython. I have modified the mailto registration in the Windows Registry so that it launches the script when someone clicks on someone's email link in a web page.

Re: Passing arguments to exe

2007-12-14 Thread kyosohma
On Dec 14, 4:51 pm, John Machin [EMAIL PROTECTED] wrote: On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote: I have created what amounts to a simple GUI email sending program using Python + wxPython. I have modified the mailto registration in the Windows Registry so that it launches the script

Re: Passing arguments to exe

2007-12-14 Thread John Machin
On Dec 15, 11:38 am, [EMAIL PROTECTED] wrote: On Dec 14, 4:51 pm, John Machin [EMAIL PROTECTED] wrote: On Dec 15, 9:01 am, [EMAIL PROTECTED] wrote: I have created what amounts to a simple GUI email sending program using Python + wxPython. I have modified the mailto registration in

Passing arguments to subclasses of unittest.TestCase

2007-11-27 Thread Tom Harris
Hi, Is there a way to pass arguments to TestCases when running tests? I have a test suite that need to be configured slightly differently for 3 different products, and rather than do a hack I wondered if there was a canonical way to do it. I _know_ that py.test can do it trivially. I am

Re: Passing arguments to subclasses of unittest.TestCase

2007-11-27 Thread Diez B. Roggisch
Tom Harris schrieb: Hi, Is there a way to pass arguments to TestCases when running tests? I have a test suite that need to be configured slightly differently for 3 different products, and rather than do a hack I wondered if there was a canonical way to do it. I _know_ that py.test can

Re: passing arguments with ampersands

2007-08-27 Thread SHY
that was the problem. when i manually reassociated the extension, i somehow didnt quote the argument for the filename. my bad. thanks for the various explanations and options for this :) cheers. 2007/8/20, Gabriel Genellina [EMAIL PROTECTED]: En Sat, 18 Aug 2007 09:24:35 -0300, SHY [EMAIL

Re: passing arguments with ampersands

2007-08-20 Thread Gabriel Genellina
En Sat, 18 Aug 2007 09:24:35 -0300, SHY [EMAIL PROTECTED] escribi�: theres no special portion of code, just the one that handles filenames with spaces. the problem is that when i associate a file extension to my application and i open it, the filename is not quoted before passed as an

Re: passing arguments with ampersands

2007-08-19 Thread O.R.Senthil Kumaran
Sorry for ignoring the thread. the problem is that when i associate a file extension to my application and i open it, the filename is not quoted before passed as an arguement. i dont If it is not quoted by default, you can quote it explicit. If this be the case where the filename is obtained

passing arguments with ampersands

2007-08-18 Thread SHY
hey, i have a win32 gui application that accepts filenames as arguments (either via command line or via associating an extension to the application) which are then opened in it. the problem is that as soon as the filename contains characters like '', the process fails at the very beginning

Re: passing arguments with ampersands

2007-08-18 Thread O.R.Senthil Kumaran
Quote:D:\ftp\Music\Mixes Compilations\Above Beyond - Essential Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt when i put 'print sys.argv[1:]' at the very beginning of the script, all i get is this: Quote:['D:\\ftp\\Music\\Mixes'] Can you share the portion of the code? Are you

Re: passing arguments with ampersands

2007-08-18 Thread Steve Holden
O.R.Senthil Kumaran wrote: Quote:D:\ftp\Music\Mixes Compilations\Above Beyond - Essential Mix\001_Essential_Mix_2004-06-06_-_Above_and_Beyond.txt when i put 'print sys.argv[1:]' at the very beginning of the script, all i get is this: Quote:['D:\\ftp\\Music\\Mixes'] Can you share the

Re: passing arguments with ampersands

2007-08-18 Thread SHY
theres no special portion of code, just the one that handles filenames with spaces. the problem is that when i associate a file extension to my application and i open it, the filename is not quoted before passed as an arguement. i dont know if its the problem of windows or something, or it was

Re: passing arguments to tcpserver classes

2007-06-18 Thread Eric Spaulding
Great -- thanks! (and also to J. Ezequiel). Mark T wrote: Eric Spaulding [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally -- srvr =SocketServer.TCPServer(('',port_num),

passing arguments to tcpserver classes

2007-06-13 Thread Eric Spaulding
Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally -- srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass) I'd like to be able to: srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass, (arg1,arg2)) And have arg1, arg2

Re: passing arguments to tcpserver classes

2007-06-13 Thread Justin Ezequiel
On Jun 13, 10:19 pm, Eric Spaulding [EMAIL PROTECTED] wrote: Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally -- srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass) I'd like to be able to: srvr

Re: passing arguments to tcpserver classes

2007-06-13 Thread Mark T
Eric Spaulding [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is there an easy way to pass arguments to a handler class that is used by the standard TCPServer? normally -- srvr =SocketServer.TCPServer(('',port_num), TCPHandlerClass) I'd like to be able to: srvr

Passing arguments to a command line from a python script

2007-03-19 Thread Luis M. González
Please forgive me if what I'm asking is non sense... I created a little program to authomate the creation of the setup.py script for py2exe. It simply prompts for the main executable script name and then creates setup.py, as follows: # this is makesetup.py nombre = raw_input('File name?: ') f

Re: Passing arguments to a command line from a python script

2007-03-19 Thread Gabriel Genellina
En Mon, 19 Mar 2007 20:46:56 -0300, Luis M. González [EMAIL PROTECTED] escribió: What I want now is execute the script I just created. As far as I know, the only way to execute the script is from a command line and typing setup.py py2exe. A few ways: - os.system(commandline). Simplest way,

Re: Passing arguments to a command line from a python script

2007-03-19 Thread Luis M. González
Genellina I'm sorry, but still I can't figure out this... Would you please show me a sample usage of os.system or os.popen for passing arguments to the command line? In this case, I should pass to the command line setuppy py2exe. Thanks! Luis -- http://mail.python.org/mailman/listinfo/python

Re: Passing arguments to a command line from a python script

2007-03-19 Thread zacherates
module - the most complete way, but simple enough for most cases. -- Gabriel Genellina I'm sorry, but still I can't figure out this... Would you please show me a sample usage of os.system or os.popen for passing arguments to the command line? In this case, I should pass to the command line

Re: Passing arguments to a command line from a python script

2007-03-19 Thread Luis M. González
. - os.popen[234]? or the functions in the popen2 module - the subprocess module - the most complete way, but simple enough for most cases. -- Gabriel Genellina I'm sorry, but still I can't figure out this... Would you please show me a sample usage of os.system or os.popen for passing

Re: Passing arguments to a command line from a python script

2007-03-19 Thread Steven Bethard
Luis M. González wrote: On Mar 19, 10:49 pm, zacherates [EMAIL PROTECTED] wrote: This implies that `os.system(setuppy py2exe)` should do what you want. It works! Thank you, this is just what I wanted. You'll get better error checking if instead you do:: import subprocess

Re: Passing arguments to a command line from a python script

2007-03-19 Thread Luis M. González
On Mar 19, 11:52 pm, Steven Bethard [EMAIL PROTECTED] wrote: Luis M. González wrote: On Mar 19, 10:49 pm, zacherates [EMAIL PROTECTED] wrote: This implies that `os.system(setuppy py2exe)` should do what you want. It works! Thank you, this is just what I wanted. You'll get better

Passing Arguments

2006-09-29 Thread theemails
New to Python ... this should be an easy question to answer. INPUT import sys print 'The command line arguments are:' for i in sys.argv: print i print '\nThe PYTHONPATH is', sys.path OUTPUT The command line arguments are: C:\Python25\using_sys.py The PYTHONPATH is

Re: Passing Arguments

2006-09-29 Thread Tim Chase
It works fine when I 'Run Module'...but when I type in interactive mode in the Python Shell python using_sys.py test1 test2 test3 I get the following error: SyntaxError: invalid syntax By using proper syntax... :*) To pass parameters, you do it when *starting* python[*]. Thus, you'd

Re: passing arguments from scale widget to function

2005-08-23 Thread m7b52000
Problem solved. use 'command = Calc' to call my Calc function but ignore the argument passed to it. Create a list with the following elements - a.get(), b.get() and c.get(). Every time a scale slider is moved, Calc will retrieve the current scale values and I can do with them whatever I

Re: passing arguments from scale widget to function

2005-08-22 Thread Matt Hammond
On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000 oh_no_you_don'[EMAIL PROTECTED] wrote: It is proving most difficult in Python. How do I pass the .get() values to my calculating function? Do I use the command option for each slider? e.g command = Calc(a.get()). Obviously not cos it doesn't

Re: passing arguments from scale widget to function

2005-08-22 Thread m7b52000
Matt Hammond wrote: On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000 oh_no_you_don'[EMAIL PROTECTED] wrote: It is proving most difficult in Python. How do I pass the .get() values to my calculating function? Do I use the command option for each slider? e.g command = Calc(a.get()).

Re: passing arguments from scale widget to function

2005-08-22 Thread Matt Hammond
On Mon, 22 Aug 2005 12:16:01 +0100, m7b52000 [EMAIL PROTECTED] wrote: command = lambda : Calc(a.get()) I get the following message when I use lambda as above: TypeError: lambda() takes no arguments (1 given) Oops, forgot! The Scale widget outputs a single argument - the value of the

Re: passing arguments from scale widget to function

2005-08-22 Thread m7b52000
Matt Hammond wrote: On Mon, 22 Aug 2005 12:16:01 +0100, m7b52000 [EMAIL PROTECTED] wrote: command = lambda : Calc(a.get()) I get the following message when I use lambda as above: TypeError: lambda() takes no arguments (1 given) Oops, forgot! The Scale widget outputs a single

Re: passing arguments from scale widget to function

2005-08-22 Thread Matt Hammond
A. Partial success with : command = Calc. A slider will now pass its argument to a function without problem. My Calc function however is expecting 3 arguments - 1 from each slider i.e moving any of the 3 sliders should cause a recalculation. I am now getting the following error:

Re: passing arguments from scale widget to function

2005-08-22 Thread m7b52000
Matt Hammond wrote: A. Partial success with : command = Calc. A slider will now pass its argument to a function without problem. My Calc function however is expecting 3 arguments - 1 from each slider i.e moving any of the 3 sliders should cause a recalculation. I am now getting the

passing arguments from scale widget to function

2005-08-21 Thread m7b52000
Some time ago I wrote a little program in Tcl/Tk that took the values from 3 sliders and performed a calculation using these values. The calculation was of course automatically repeated each time a slider was moved. It is proving most difficult in Python. How do I pass the .get() values to my

Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Gregory Piñero
Hey guys, would someone mind giving me a quick rundown of how references work in Python when passing arguments into functions? The code below should highlight my specific confusion: code bool1=True lst1=[1,2,3] def func1(arg1): arg1.append(4) def func2(arg1): arg1=False func1(lst1) lst1

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Christopher Subich
Gregory Piñero wrote: Hey guys, would someone mind giving me a quick rundown of how references work in Python when passing arguments into functions? The code below should highlight my specific confusion: All arguments are passed by reference, but in Python equality rebinds the name. code

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Rocco Moretti
Christopher Subich wrote: Gregory Piñero wrote: Hey guys, would someone mind giving me a quick rundown of how references work in Python when passing arguments into functions? The code below should highlight my specific confusion: This URL is always tossed out: http://starship.python.net

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread infidel
in Python equality rebinds the name Assignment (=) rebinds the name. Equality (==) is something else entirely. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Dan
Does that mean Python functions aren't always byref, but are sometimes byval for nonmutables? Don't think of it as byref or byval (as they are used in Visual Basic). All parameters are passed the same way: by reference instead of by copy. It's a little difficult to get your head around, but I

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Rocco Moretti
Gregory Piñero wrote: Ahh, so it's a mutable thing. That makes sense that I can't change a mutable object and thus can't affect it outside of the function. If you meant immutable for the second mutable, you're right. Does that mean Python functions aren't always byref, but are sometimes

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Christopher Subich
Dennis Lee Bieber wrote: In a more simplistic view, I'd reverse the phrasing... The name x is assigned to the object y (implying it is no longer attached to whatever used to have the name) No, because that'd imply that the object 'y' somehow keeps track of the names assigned to it,

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Rocco Moretti
Dennis Lee Bieber wrote: On Tue, 09 Aug 2005 10:39:29 -0500, Rocco Moretti [EMAIL PROTECTED] declaimed the following in comp.lang.python: Change it to the object referenced by y is assigned to the name of x, and you're closer to the truth. In a more simplistic view, I'd reverse the

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Rocco Moretti
Christopher Subich wrote: Rocco Moretti wrote: Variables in Python are names. They aren't the cubbyholes into which you put values, they are sticky notes on the front of the cubby hole. +1 MOTW (Metaphor of the Week) Thanks, but please note it's not really mine - I've seen it somewhere

Re: Passing arguments to function - (The fundamentals are confusing me)

2005-08-09 Thread Terry Reedy
Gregory Piñero [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] how references work in Python 'references' are an implementation detail and a metaconcept used to talk about Python but are not part of the language spec itself. when passing arguments into functions? Python does

Re: Passing arguments to function - (The fundamentals are confusingme)

2005-08-09 Thread Terry Reedy
Christopher Subich [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dennis Lee Bieber wrote: In a more simplistic view, I'd reverse the phrasing... The name x is assigned to the object y (implying it is no longer attached to whatever used to have the name) I agree that this is the

Re: Passing arguments to function - (The fundamentals are confusingme)

2005-08-09 Thread Terry Reedy
Gregory Piñero [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Ahh, so it's a mutable thing. That makes sense that I can't change a mutable object and thus can't affect it outside of the function. You of course meant immutable, but this is still confused. It is a name-binding

passing arguments to a function - do I need type ?

2005-07-10 Thread Philipp H. Mohr
Hello, I got a newbie question, I have written the following distance function: def distance(self,element1, element2): dist = 0 for n in range(len(element1)): dist = dist + pow((element1[n] - element2[n]),2) print 'dist' + dist return sqrt(dist) and

Re: passing arguments to a function - do I need type ?

2005-07-10 Thread Jorgen Grahn
(You posted your question as a followup to oen of Xah Lee's musings. That is not the best of ideas, since people with threaded newsreaders tend not to see it. Just post (creating a new thread) next time.) On Sun, 10 Jul 2005 11:19:31 +0100 (BST), Philipp H. Mohr [EMAIL PROTECTED] wrote: Hello,

Re: passing arguments to a function - do I need type ?

2005-07-10 Thread George Sakkis
Philipp H. Mohr [EMAIL PROTECTED] wrote: Hello, I got a newbie question, I have written the following distance function: def distance(self,element1, element2): dist = 0 for n in range(len(element1)): dist = dist + pow((element1[n] - element2[n]),2)

Re: passing arguments to a function - do I need type ?

2005-07-10 Thread Steven D'Aprano
On Sun, 10 Jul 2005 11:19:31 +0100, Philipp H. Mohr wrote: Hello, I got a newbie question, I have written the following distance function: Great. Now, how about you tell us what you expect it to do? I assume it calculates the Euclidean distance between two points. (If you don't know what

Re: passing arguments to a function - do I need type ?

2005-07-10 Thread Paul McGuire
Is getCenter a function? If so, you need to invoke distance using: dist = self.distance( n.getCenter(), newElement ) Of course, that is assuming that newElement is a local variable of type list/tuple/etc. -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments to a function - do I need type ?

2005-07-10 Thread Philipp H. Mohr
Hello, thank you very much for all your help. I have solved the problem - you guys where right, the problem was some where else. I have another class which got an accessor: def getCenter(self): global center return center and I called it by saying n.getCenter, but this

Re: passing arguments

2005-05-22 Thread Philippe C. Martin
Hi, look at sys.argv Regards, Philippe Jeff Elkins wrote: I'm sure this is obvious, but how the heck do pass an argument(s) to a python script from the command line? Thanks, Jeff Elkins -- http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments

2005-05-22 Thread Steve Holden
Steven Bethard wrote: James Stroud wrote: import sys try: arg1 = sys.argv[1] except IndexError: print This script takes an argument, you boob! sys.exit(1) Also possible, to guarantee that exactly one argument was given: try: arg1, = sys.argv except ValueError: print This

Re: passing arguments

2005-05-22 Thread Steve Holden
Dennis Lee Bieber wrote: On Sun, 22 May 2005 16:12:06 -0400, Steve Holden [EMAIL PROTECTED] declaimed the following in comp.lang.python: Aren't we forgetting argv[0] here, or am I overlooking something (like, you chopped it off without telling me?)? argv[0] is often just the

Re: passing arguments

2005-05-22 Thread Steven Bethard
Steve Holden wrote: Steven Bethard wrote: Also possible, to guarantee that exactly one argument was given: try: arg1, = sys.argv except ValueError: print This script takes an argument, you boob! sys.exit(1) Aren't we forgetting argv[0] here Oops. Yup. Change all sys.argv to

Re: passing arguments

2005-05-20 Thread James Stroud
import sys try: arg1 = sys.argv[1] except IndexError: print This script takes an argument, you boob! sys.exit(1) OR, way better: See the optparse module. On Friday 20 May 2005 03:26 pm, Jeff Elkins wrote: I'm sure this is obvious, but how the heck do pass an argument(s) to a python

Re: passing arguments

2005-05-20 Thread Jeff Elkins
On Friday 20 May 2005 06:46 pm, James Stroud wrote: import sys try: arg1 = sys.argv[1] except IndexError: print This script takes an argument, you boob! sys.exit(1) OR, way better: See the optparse module. On Friday 20 May 2005 03:26 pm, Jeff Elkins wrote: I'm sure this is

Re: passing arguments

2005-05-20 Thread Daniel Bickett
An even better way would be to use the optparse module.-- Daniel Bickettdbickett at gmail.comhttp://heureusement.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: passing arguments

2005-05-20 Thread Steven Bethard
James Stroud wrote: import sys try: arg1 = sys.argv[1] except IndexError: print This script takes an argument, you boob! sys.exit(1) Also possible, to guarantee that exactly one argument was given: try: arg1, = sys.argv except ValueError: print This script takes an argument,

Re: Passing arguments to python from URL

2005-03-22 Thread David M. Cooke
Casey Bralla [EMAIL PROTECTED] writes: I've got a python cgi-bin application which produces an apache web page. I want to pass arguments to it on the URL line, but the parameters are not getting passed along to python properly. I've been using sys.argv to pick up command line arguments, and

  1   2   >