Is there a way to execute shell commands on VMWare server via PyVMomi?

2015-02-11 Thread Johnny Ting Shi
We have some VM running on top of EXSi. We want to be to run some remote arbitrary commands on the VM, anyone has experience with https://github.com/vmware/pyvmomi? which command do i need to call? Thanks -- https://mail.python.org/mailman/listinfo/python-list

Re: Make a small function thread safe

2011-12-19 Thread ting
On Dec 16, 8:21 am, Brad Tilley wrote: > A thread locks the function on entrance and then releases it on exit. > What is the equivalent way to do this in Python? I'm not sure if this applies in your case, but much of the time, you can use thread local storage, rather thread locking, in order to m

Re: re.sub(): replace longest match instead of leftmost match?

2011-12-19 Thread ting
On Dec 16, 11:49 am, John Gordon wrote: > I'm working with IPv6 CIDR strings, and I want to replace the longest > match of "(:|$)+" with ":".  But when I use re.sub() it replaces > the leftmost match, even if there is a longer match later in the string. Typically this means that your regu

Re: Doctest failing

2011-09-10 Thread ting
On Sep 10, 7:47 am, Peter Otten <__pete...@web.de> wrote: > Tigerstyle wrote: > > I'm strugglin with some homework stuff and am hoping you can help me > > out here. > > > This is the code: > > > small_words = ('into', 'the', 'a', 'of', 'at', 'in', 'for', 'on') > >     new_title = [] > >     title_s

Re: List comprehension timing difference.

2011-09-02 Thread ting
On Sep 2, 9:54 am, Bart Kastermans wrote: > if d(a,b) == 1 and a < b: It will probably be faster if you reverse the evaluation order of that expression. if ahttp://mail.python.org/mailman/listinfo/python-list

Re: is there any principle when writing python function

2011-08-25 Thread ting
On Aug 23, 7:59 am, smith jack wrote: > i have heard that function invocation in python is expensive, but make > lots of functions are a good design habit in many other languages, so > is there any principle when writing python function? > for example, how many lines should form a function? My su

Re: Run time default arguments

2011-08-25 Thread ting
On Aug 25, 10:35 am, Arnaud Delobelle wrote: > You're close to the usual idiom: > > def doSomething(debug=None): >     if debug is None: >         debug = defaults['debug'] >     ... > > Note the use of 'is' rather than '==' > HTH Hmm, from what you are saying, it seems like there's no elegant wa

Run time default arguments

2011-08-25 Thread ting
What is the most common way to handle default function arguments that are set at run time, rather than at compile time? The snippet below is the current technique that I've been using, but it seems inelegant. defaults = { 'debug' : false } def doSomething (debug = None): debug = debug if debug