First  |  Prev |  Next  |  Last
Pages: 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344
sort(cmp=func)
I have a list of objects that generate code. Some of them depend on others being listed first, to satisfy dependencies of others. I wrote a cmp function something like this: def dep_cmp(ob1, ob2): if ob1.name in ob2.deps: return -1 else: return 1 I also tried returning 0 when there were no dep... 10 Jul 2008 15:29
Dynamic HTML from Python Script
Dave Parker wrote: On Jun 11, 10:43 pm, Dennis Lee Bieber <wlfr...(a)ix.netcom.com> wrote: Those are not /server side/ refreshes... Correct. But we weren't discussing server side refreshes. We were discussing how to make the "browser refresh automatically in the server side": Two things: ... 9 Jul 2008 22:58
TypeError, I know why but not how!?
Im looking into PvsNP: http://www.claymath.org/millennium/P_vs_NP/ so I thought I'd write the program just to get a feel for it. But I run into a problem. Why does it all the sudden return None? I mean I know why the program aborts but I dont understand why the None is generated all the sudden. Hitting recursi... 10 Jul 2008 22:41
Manipulating bitsets in struct
I'm using Python to do some simple network programming, and found the struct module very useful for such things, but is there a way to easily manipulate bitsets such as a 16 bit word being split into 4 parts like 2 bits, 1 bit, 4 bits, and 9 bits? Perhaps something like: struct.pack('!h(2:1:4:9)',2,0,1,100)... 10 Jul 2008 01:01
redirecting output of process to a file using subprocess.Popen()
I am trying to redirect stderr of a process to a temporary file and then read back the contents of the file, all in the same python script. As a simple exercise, I launched /bin/ls but this doesn't work: #!/usr/bin/python import subprocess as proc import tempfile name = tempfile.NamedTemporaryFile(mode='w+b') ... 10 Jul 2008 18:35
Py_BuildValue for char **?
Hi, I'm writing a wrapper module of C API. To make a C struct data avaiable to Python, I need to map C struct into a PyObject. I'm thinking that I use a tuple or dict to represent the struct but a problem is one of the members of the struct is char **, which is not supported by Py_BuildValue. Is there any idi... 10 Jul 2008 01:01
Terminate a python script from linux shell / bash script
Hello :-) I have a question about Python and Linux shell. I have a python program which is permanently resident in the end-user system. I'm currently producing a RPM package, and it works nicely. The problem is that when I uninstall it, my program keeps running in the background, even if the files are deleted. ... 31 Jul 2008 08:15
Python equivalent of call/cc?
Yesterday, I was hacking around a bit, trying to figure out how to implement the semantics of call/cc in Python. Specifically, I wanted to translate this Scheme code to equivalent Python: #### (define theContinuation #f) (define (test) (let ((i 0)) (call/cc (lambda (k) (set! theContinuation k)... 9 Jul 2008 23:59
Retrieving BSTR * from a DLL
I need to interface with a windows DLL that has the following signature extern "C" void Foo( BSTR in, BSTR *out ) Code so far from ctypes import * import comtypes LPBSTR = POINTER(comtypes.BSTR) hdl = windll.MyDll.Foo hdl.rettype = None hdl.argtypes = [comtypes.BSTR, LPBSTR] ... 10 Jul 2008 09:16
variable question
"Support Desk" <support.desk.ipg(a)gmail.com> wrote in message news:01da01c8e1fb$7615a4f0$a701a8c0(a)office.ipglobal.net... I am trying to assign a variable using an if / else statement like so: If condition1: Variable = something If condition2: Variable = something else Do s... 10 Jul 2008 02:02
First  |  Prev |  Next  |  Last
Pages: 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344