hey did you find the answer for this
--
https://mail.python.org/mailman/listinfo/python-list
Chris Rebert 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 obvious call:
Ismael Farfán 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 works:
os.syste
On Wed, Sep 19, 2012 at 12:50 PM, 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 )
> to a python script, remote.py running on 'remote' (the remote machine).
> 3. Has anybody
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, contai
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
>
> 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 argum
On Thu, Sep 20, 2012 at 2:27 PM, Steven D'Aprano
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 ) to a python script, remote.py
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
ashish 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 like spaces, et
2012/9/19 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
Thanks for the help Peter.Its working fine now
--
http://mail.python.org/mailman/listinfo/python-list
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 execu
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/
--
http://mail.pyth
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 PROTECT
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 w
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 t
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):
e
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):
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
On Dec 14, 8:06 pm, John Machin <[EMAIL PROTECTED]> wrote:
>
> > 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 addres
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 registrat
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
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.
>
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.t
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
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
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
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 just
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
> 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?
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),
"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 =Socke
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 =SocketServer.TCPServer
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.
>
>
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 subpro
On Mar 19, 10:49 pm, "zacherates" <[EMAIL PROTECTED]> wrote:
> On Mar 19, 9:42 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Mar 19, 9:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
> > wrote:
>
> > > En Mon, 19 Mar 2007 20:46:56 -0300, Luis M. González <[EMAIL PROTECTED]>
> > > es
On Mar 19, 9:42 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote:
> On Mar 19, 9:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
> wrote:
>
>
>
> > 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.
> >
On Mar 19, 9:25 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> 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 a
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"). Simple
> 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,
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
want...
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 gettin
> 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
> erro
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: () takes no arguments (1 given)
>
>
> Oops, forgot! The Scale widget outp
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: () takes no arguments (1 given)
Oops, forgot! The Scale widget outputs a single argument - the value of
the
Matt Hammond wrote:
> On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000
> 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
On Sun, 21 Aug 2005 08:09:55 +0100, m7b52000
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 work.
It should work if you w
"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
"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 tha
"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
Gregory Piñero wrote:
> So what if I do want to share a boolean variable like so:
Well, the easiest way is to wrap it in a list:
mybool = [True]
mybool[0] = False
mybool[0] = True
and so on.
Alternately, what is this boolean attached to that's so significant?
Sharing an arbitrary boolean, with
Thanks everyone. I understand now. Everything is a reference, all
that matters is whether I can go inside the "cubbyhole" and change
something. Immutables don't allow this.
So what if I do want to share a boolean variable like so:
sharedbool=True
class cls1:pass
cl=cls1()
cl.sharedbool1=shared
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 s
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'
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)
--
http://mail.python.org/mailman/listinfo/python-list
infidel wrote:
>>in Python equality rebinds the name
>
>
> Assignment (=) rebinds the name. Equality (==) is something else
> entirely.
Good catch. I was thinking of it as the "equals" operator.
--
http://mail.python.org/mailman/listinfo/python-list
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
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 someti
> 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
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. Does
that mean Python functions aren't always byref, but are sometimes
byval for nonmutables?
-Greg
On 8/9/05, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
> On
> in Python equality rebinds the name
Assignment (=) rebinds the name. Equality (==) is something else
entirely.
--
http://mail.python.org/mailman/listinfo/python-list
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.pytho
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.
>
>
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 returns:
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
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 Eucl
"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)
>
(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
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. Ch
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 ofte
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 Va
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
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 a
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
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
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
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 argument
Thanks...it worked perfectly.
Brilliant!!
JL
Duncan Booth <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> John Leslie wrote:
>
> > I am porting a script from Korn Shell to python and want to pass named
> > parameters like -JOB 123456 -DIR mydir
> >
> > I can get it to work p
John Leslie wrote:
> I am porting a script from Korn Shell to python and want to pass named
> parameters like -JOB 123456 -DIR mydir
>
> I can get it to work passing --JOB and --DIR but not -JOB and -DIR
>
> Any ideas?
>
Unfortunately (for you), I think you will find most or all of the existing
79 matches
Mail list logo