Re: How to decompress .Z file?

2007-08-20 Thread Nick Craig-Wood
library reference, .Z file might not be supported by python, yet. Unfortunately the python gzip library doesn't read .Z files. I'd pipe the data to zcat using subprocess to decompress from python. I haven't used a .Z files for many many years - where are you getting them from? -- Nick Craig-Wood

Re: How to say $a=$b-{A} ||={} in Python?

2007-08-18 Thread Nick Craig-Wood
ns gets you a new dict... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to say $a=$b-{A} ||={} in Python?

2007-08-18 Thread Nick Craig-Wood
but recursively. from collections import defaultdict class hash(defaultdict): def __init__(self): defaultdict.__init__(self, hash) D=hash() D[1][2][3][4]=5 D[1][4][5]=6 print D -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman

Re: Python and Tkinter Programming--Expensive!

2007-08-18 Thread Nick Craig-Wood
on TK programming using classes, making re-usable components which I found really helpful compared to the ad-hoc way I'd seen TK presented previously. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: The Future of Python Threading

2007-08-11 Thread Nick Craig-Wood
Bjoern Schliessmann [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: [GIL] That is certainly true. However the point being is that running on 2 CPUs at once at 95% efficiency is much better than running on only 1 at 99%... How do you define this percent efficiency? Those

Re: The Future of Python Threading

2007-08-10 Thread Nick Craig-Wood
. python-mt would certainly be slower for non threaded tasks, but it would certainly be quicker for threaded tasks on multiple CPU computers. The user could then choose which python to run. This would of course make C extensions more complicated... -- Nick Craig-Wood [EMAIL PROTECTED] -- http

Re: High performance binary data

2007-08-10 Thread Nick Craig-Wood
looking for a any one with experience or ideas on the subject. Pointers any one? Check out construct: http://construct.wikispaces.com/ -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Interprocess communication woes

2007-07-19 Thread Nick Craig-Wood
, fooling the program, and the C library, into thinking that it is speaking to a terminal and turn off buffering. Pexpect doesn't work on windows. The fact that ping works is because it uses fflush() - you can see this if you ltrace it. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: wxPython and threads

2007-07-19 Thread Nick Craig-Wood
for a resource and you want to block when a resource is not available). I'd dispute that. If you are communicating between threads use a Queue and you will save yourself thread heartache. Queue has a non blocking read interface Queue.get_nowait(). -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: wxPython and threads

2007-07-19 Thread Nick Craig-Wood
Josiah Carlson [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: I'd dispute that. If you are communicating between threads use a Queue and you will save yourself thread heartache. Queue has a non blocking read interface Queue.get_nowait(). If you have one producer and one consumer

Re: Pickled objects over the network

2007-07-18 Thread Nick Craig-Wood
is re-inventing the wheel. Use pyro instead... http://pyro.sourceforge.net/ Pyro does use pickle to serialise objects by default. It can use XML instead for an exploit free RPC at the cost of a bit of speed. http://pyro.sourceforge.net/manual/9-security.html#pickle -- Nick Craig-Wood

Single-stepping through a python script

2007-07-17 Thread Craig Howard
Hello All: Is is possible to compile a code object and single-step through its execution? Craig -- http://mail.python.org/mailman/listinfo/python-list

Re: Embedding/Extending Python in/with C++: non-static members?

2007-07-17 Thread Nick Craig-Wood
the method call to that particular instance. Looking at this page might give you some ideas http://gcc.gnu.org/onlinedocs/gccint/Trampolines.html This probably isn't a good approach in reality though as it is very architecture / compiler dependent! -- Nick Craig-Wood [EMAIL PROTECTED] -- http

Single-stepping through a python script

2007-07-17 Thread Craig Howard
Craig Howard schrieb: Hello All: Is is possible to compile a code object and single-step through its execution? import pdb; pdb.set_trace() Look up the pdb module documentation. Diez Sorry, I didn't give enough detail. Is it possible to single-step through a code object without

Re: 2**2**2**2**2 wrong? Bug?

2007-07-12 Thread Nick Craig-Wood
: This helps to find the answer to the problem Which is the largest number that can be written with only 3 digits? Some people stop at 999, others try 99**9 and 9**99, and the winner is 9**9**9, or: Actually I think 9**9E9 is bigger! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: os.wait() losing child?

2007-07-12 Thread Nick Craig-Wood
Jason Zheng [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: The problem you are having is you are letting Popen do half the job and doing the other half yourself. Except that I never wanted Popen to do any thread management for me to begin with. Popen class has advertised itself

Re: os.wait() losing child?

2007-07-12 Thread Nick Craig-Wood
Hrvoje Niksic [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] writes: I think your polling way works; it seems there no other way around this problem other than polling or extending Popen class. I think polling is probably the right way of doing it... It requires

Re: os.wait() losing child?

2007-07-11 Thread Nick Craig-Wood
')) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: bool behavior in Python 3000?

2007-07-11 Thread Nick Craig-Wood
in python then use the logical operators (and or not) and not the arithmetical operators. Eg False or not True False -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: storing pickles in sql data base

2007-07-11 Thread Nick Craig-Wood
() b 'eJzTyCkw5PI04Er0NARiIyA2BmITIDYFYjMgNgdiCyC25ErUAwD5DQqD' loads(b.decode(base64).decode(zip)) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Empty text

2007-07-10 Thread Nick Craig-Wood
Miles [EMAIL PROTECTED] wrote: On Jul 9, 4:30 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sun, 08 Jul 2007 22:23:20 +0200, Jan Danielsson wrote: Firefox is very unhappy about the textarea not having separate opening

Re: Should I use Python for these programs?

2007-07-10 Thread Nick Craig-Wood
you think Python is the right language for these projects? Yes! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess popen trouble

2007-07-10 Thread Nick Craig-Wood
at interactive conversations between the main process and the subprocess - buffering will cause you problems. You may in this simple case get it to work with a) or b) though! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Machine A python script execute Machine B python script?

2007-07-09 Thread Nick Craig-Wood
code, Pyro takes care of the network communication between your objects once you split them over different machines on the network. All the gory socket programming details are taken care of, you just call a method on a remote object as if it were a local object! -- Nick Craig-Wood [EMAIL PROTECTED

Re: Empty text

2007-07-09 Thread Nick Craig-Wood
which tags we were having problems with), using the declaration :- ?xml version=1.0 encoding=iso-8859-1? !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; I haven't tested this again recently though. -- Nick Craig-Wood

Re: trouble controlling vim with subprocess on windows machine

2007-07-09 Thread Nick Craig-Wood
at conversations. I'd suggest pexpect but it doesn't work on windows. You appear to be doing stuff with csound. There are several python modules out there which interface with csound - did you investigate those? -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: what is wrong with that r\

2007-07-05 Thread Nick Craig-Wood
'\ '\'\\' r''' '\'' Neil is correct in saying that his example works for regexp matching though, as the regexp matcher understands \ as being the same as . So r strings work well as Regexp-strings but not so well as Raw-strings IMHO. -- Nick Craig-Wood [EMAIL PROTECTED] -- http

Re: Callback scoping

2007-07-05 Thread Nick Craig-Wood
of (no parameter) functions, each of which returns its index in the list.) This is the traditional way :- x = [ lambda ind=ind: ind for ind in range(10) ] x[0]() 0 x[2]() 2 x[9]() 9 -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: what is wrong with that r\

2007-07-04 Thread Nick Craig-Wood
of the string, not as a line continuation. As I'd expect. If we removed a) then we could remove b) also and r strings would work as everyone expects. Does anyone know the justification for a)? Maybe we should remove it in py3k? -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com

Re: what is wrong with that r\

2007-07-04 Thread Nick Craig-Wood
the proper way of writing it is either r\\ or r\ I don't think so... r\\ '' r\ '\\' Indicating that all the \ in the above are inserted literally. Maybe you meant \\ '\\' \ '' -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: How to close a program I execute with subprocess.Popen?

2007-07-01 Thread Nick Craig-Wood
and os.getpgid. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

import data.py using massive amounts of memory

2007-06-27 Thread Nick Craig-Wood
memory_usage import memory from cPickle import load before = memory() z = load(open(z.bin, rb)) after = memory() print Memory used to unpickle is %s kB % (after-before) print Total size of repr(z) is ,len(repr(z)) -- Nick Craig-Wood

Re: 16bit hash

2007-06-27 Thread Nick Craig-Wood
. That said you aren't going to be doing any serious crypto with only 16 bits. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: automatical pdf generating

2007-06-25 Thread Nick Craig-Wood
to a max dimension of 1000 pixels and then tiles them into a PDF. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Chroot Jail Not Secure for Sandboxing Python?

2007-06-25 Thread Nick Craig-Wood
their jobs. When confined in this way, the ability of these user programs and system daemons to cause harm when compromised (via buffer overflows or misconfigurations, for example) is reduced or eliminated. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: configparser shuffles all sections ?

2007-06-22 Thread Nick Craig-Wood
._sections = odict() self._defaults = odict() -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python/C API bug (multithreading)

2007-06-20 Thread Nick Craig-Wood
/index.php?func=detailaid=1163563group_id=5470atid=105470 Is there any simple way to fix this damned bug?? Locking, locking and more locking ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Using a switch-like if/else construct versus a dictionary?

2007-06-19 Thread Nick Craig-Wood
or id in your objects and you are switching on it, then you should be using polymorphism. Make each seperate type a seperate class type and implement the methods for each one. All the switches will disappear from your code like magic! Post more details if you want more help! -- Nick Craig-Wood

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
) except OSError: print locked! else: try: do_stuff() finally: os.rmdir(lock) (untested) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
equivalent also) http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 or use the directory idea I posted in another post. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
can then send a signal to the running copy, detect stale lock files etc. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: avoid script running twice

2007-06-18 Thread Nick Craig-Wood
Tim Williams [EMAIL PROTECTED] wrote: On 18/06/07, Nick Craig-Wood [EMAIL PROTECTED] wrote: On Windows the open-a-file-for-writing method works well, but as *nix doesn't work the same way then maybe the socket solution is the best cross-platform option. Actually you could combine your

Re: Bug/Weak Implementation? popen* routines can't handle simultaneous read/write?

2007-06-09 Thread Nick Craig-Wood
dmoore [EMAIL PROTECTED] wrote: On Jun 8, 12:30 pm, Nick Craig-Wood [EMAIL PROTECTED] wrote: Windows has a really strange idea of non-blocking IO - it uses something called overlapped io. You or in the FILE_FLAG_OVERLAPPED flag when you create the file/pipe. You then pass in overlap

Re: Bug/Weak Implementation? popen* routines can't handle simultaneous read/write?

2007-06-08 Thread Nick Craig-Wood
. It is the proper answer to controlling other interactive processes IMHO. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Bug/Weak Implementation? popen* routines can't handle simultaneous read/write?

2007-06-07 Thread Nick Craig-Wood
pexpect wpuld be useful too (ie scan for these regexps or timeout and return a match object). -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess leaves child living

2007-06-05 Thread Nick Craig-Wood
may (or may not) kill it. At least it got some sort of notification. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Non-blocking subprocess call

2007-06-04 Thread Nick Craig-Wood
so should work fine there -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Comments appreciated on Erlang inspired Process class.

2007-06-04 Thread Nick Craig-Wood
it to the parent (see the subprocess module for an example). -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting an active exception

2007-06-03 Thread Nick Craig-Wood
programmer probably means you aren't thinking in python yet. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Adding tuples to a dictionary

2007-06-01 Thread Nick Craig-Wood
-- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python memory handling

2007-06-01 Thread Nick Craig-Wood
to 4k then you'd have the perfect memory allocator... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Module listing in order.

2007-05-28 Thread Nick Craig-Wood
# '__main__.E'] -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile stupidly broken

2007-05-19 Thread Nick Craig-Wood
Martin Maney [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: You don't need to do that, you can just monkey patch the _EndRecData function. For a quick dirty test, sure. If I were certain I'd only ever use this on one machine for a limited time (viz, no system

Re: How to convert a number to binary?

2007-05-18 Thread Nick Craig-Wood
was looking for. Works for other bases too. Just don't pass it a negative number ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: zipfile stupidly broken

2007-05-18 Thread Nick Craig-Wood
it, but that's even uglier than it is stupid. This battery is pining for the fjords! You don't need to do that, you can just monkey patch the _EndRecData function. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: A bug in cPickle?

2007-05-17 Thread Nick Craig-Wood
(pickle.dumps('1001799')) '1001799' cPickle.loads(cPickle.dumps('1001799')) '1001799' -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Subprocess with and without shell

2007-05-15 Thread Nick Craig-Wood
Produces $ ./z.py Without shell stderr: Stderr stdout: Stdout With shell stderr: Stderr stdout: Stdout -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to choose between python and java

2007-05-15 Thread Nick Craig-Wood
. You'll be a lot more productive writing python code in my experience so if development time is important to you, then go with python. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Asyncore Help?

2007-05-14 Thread Nick Craig-Wood
with the speed. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 3131: Supporting Non-ASCII Identifiers

2007-05-14 Thread Nick Craig-Wood
are in ASCII/English. I hope you weren't thinking of changing them? ... In summary, I'm not particularly keen on the idea; though it might be all right in private. Unicode identifiers are allowed in java though, so maybe I'm worrying too much ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig

Re: High resolution sleep (Linux)

2007-05-11 Thread Nick Craig-Wood
Bart [EMAIL PROTECTED] wrote: What about C module with usleep,nanosleep? Unlikely to help! It is an linux OS limit that the minimum sleep time is 1/HZ. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Binding

2007-05-06 Thread Nick Craig-Wood
this? Sounds like a job for ctypes which is bundled with py 2.5. http://docs.python.org/lib/module-ctypes.html It is great for access C libraries (assuming you have a shared library (.so or .dll). You'll end up writing python code rather than C code which you'll enjoy! -- Nick Craig-Wood [EMAIL

Re: High resolution sleep (Linux)

2007-05-05 Thread Nick Craig-Wood
calibration to work out the overhead of the function on any given machine to make it more accurate. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: My Python annoyances

2007-05-04 Thread Nick Craig-Wood
windows always works though (with mingw as the compiler). -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Want to build a binary header block

2007-05-02 Thread Nick Craig-Wood
in a declarative manner, rather than procedural code: more complex constructs are composed of a hierarchy of simpler ones. It's the first library that makes parsing fun, instead of the usual headache it is today. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org

Re: trinary operator - if then else

2007-04-25 Thread Nick Craig-Wood
: False or '' and 0 '' You can use this if you want it to be bullet proof (a and [b] or [c])[0] Not exactly elegant though! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Convert a string to a list

2007-04-24 Thread Nick Craig-Wood
', 'cadence.py', 'cdsinit_cdsenv_cleanup.py') It made tuples rather than lists but I expect that won't matter. Someone normally chimes in with pyparsing at this point... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python

Re: Binary file output using python

2007-04-19 Thread Nick Craig-Wood
. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: subprocess confusion

2007-04-17 Thread Nick Craig-Wood
to be thinking it is pre-pending something to your command line which isn't how it works. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Python Feature Request: Allow changing base of member indices to 1

2007-04-15 Thread Nick Craig-Wood
then it is *definitely* a feature too far for python ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: with timeout(...):

2007-03-31 Thread Nick Craig-Wood
Hendrik van Rooyen [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: I'd like there to be something which works well enough for day to day use. Ie doesn't ever wreck the internals of python. It could have some caveats like may not timeout during C functions which

Re: with timeout(...):

2007-03-31 Thread Nick Craig-Wood
John Nagle [EMAIL PROTECTED] wrote: Diez B. Roggisch wrote: Nick Craig-Wood wrote: Did anyone write a contextmanager implementing a timeout for python2.5? And have it work reliably and in a cross platform way! Cross platform isn't the issue here - reliability though is. To put

Re: with timeout(...):

2007-03-29 Thread Nick Craig-Wood
Hendrik van Rooyen [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: Well, yes there are different levels of potential reliability with different implementation strategies for each! Gadzooks! Foiled again by the horses for courses argument. ; - ) ;-) I'd like

Re: with timeout(...):

2007-03-29 Thread Nick Craig-Wood
lock won't prevent the called C-code from taking as long as it wants. |And there is nothing you can do about that. I'm assuming that the timeout function is running in a thread... -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo

Re: with timeout(...):

2007-03-28 Thread Nick Craig-Wood
Hendrik van Rooyen [EMAIL PROTECTED] wrote: Nick Craig-Wood [EMAIL PROTECTED] wrote: Hendrik van Rooyen [EMAIL PROTECTED] wrote: But would be useful to be able to do without messing with threads and GUI and imports. Could be hard to implement as the interpreter would have

Re: with timeout(...):

2007-03-27 Thread Nick Craig-Wood
Klaas [EMAIL PROTECTED] wrote: On Mar 26, 3:30 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: Did anyone write a contextmanager implementing a timeout for python2.5? I'd love to be able to write something like with timeout(5.0) as exceeded: some_long_running_stuff

Re: with timeout(...):

2007-03-27 Thread Nick Craig-Wood
don't think it would buy us anything except a whole host of problems! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: detect suprocess interaction

2007-03-26 Thread Nick Craig-Wood
it is to do with the controlling terminal... On my system $ setsid svn ls svn+ssh://[EMAIL PROTECTED]/svn /dev/null /dev/null 21 Pops up a gui box asking for the password! You can simulate the above with Popen(..., stdin=file(os.devnull,r), preexec_fn=os.setsid) -- Nick Craig-Wood [EMAIL

with timeout(...):

2007-03-26 Thread Nick Craig-Wood
! From my experiments with timeouts I suspect it won't be possible to implement it perfectly in python 2.5 - maybe we could add some extra core infrastructure to Python 3k to make it possible? -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Nick Craig-Wood
ping command is using btw, is probably running suid root. Under linux the only priviledge you need is CAP_NET_RAW. It is possible to give this to a process - a bit of searching with google will show you how! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

Re: Sending ECHO_REQUEST (pinging) with python

2007-03-26 Thread Nick Craig-Wood
Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Mon, 26 Mar 2007 16:50:33 +0200, Thomas Dybdahl Ahle [EMAIL PROTECTED] wrote: Den Mon, 26 Mar 2007 06:30:04 -0500 skrev Nick Craig-Wood: Under linux the only priviledge you need is CAP_NET_RAW. It is possible to give this to a process

Re: with timeout(...):

2007-03-26 Thread Nick Craig-Wood
think timeouts would be any more difficult that using threads. It is impossible to implement reliably at the moment though because it is impossible to kill one thread from another thread. There is a ctypes hack to do it, which sort of works... It needs some core support I think. -- Nick Craig

Re: with timeout(...):

2007-03-26 Thread Nick Craig-Wood
James Stroud [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: Did anyone write a contextmanager implementing a timeout for python2.5? I'd love to be able to write something like with timeout(5.0) as exceeded: some_long_running_stuff() if exceeded: print

Re: Garbage collection

2007-03-21 Thread Nick Craig-Wood
then the heap will be fragmented and you'll never be able to return the memory to the OS. However that is why we have virtual memory systems. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Using pxssh

2007-03-19 Thread Nick Craig-Wood
the debian packaged version 2.1-1 with python 2.4 -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: number generator

2007-03-12 Thread Nick Craig-Wood
on average 0.5 times. If 0 isn't required then just test for it and go around the loop again if found. That of course skews the distribution in difficult to calculate ways! -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python

Re: Bitpacked Data

2007-03-12 Thread Nick Craig-Wood
://construct.wikispaces.com/ This allows you to build a python class which will translate to and from that datastructure. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Nick Craig-Wood
for docstrings) Python just ignores strings that lie around. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Nick Craig-Wood
Robert Marshall [EMAIL PROTECTED] wrote: On Fri, 09 Mar 2007, Bruno Desthuilliers wrote: Nick Craig-Wood a ?crit : [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What if 2 new 'special' comment-like characters were added to Python?: 1. The WIP (Work In Progress) comment: I

Re: pyHook or SetWindowsHookEx

2007-02-28 Thread craig wickesser
well the problem I have only occurs when my python app. is running as a Windows Service. if I run the python app. as a process (i.e. from the command line) it works as epxected via Remote Desktop. still not sure what's going on. On 2/28/07, Sick Monkey [EMAIL PROTECTED] wrote: I have just

Re: Creating a daemon process in Python

2007-02-23 Thread Nick Craig-Wood
for child to die os._exit(0) else: # wait for child to die and then bail os.wait() sys.exit() -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: f---ing typechecking

2007-02-21 Thread Nick Craig-Wood
Delaney, Timothy (Tim) [EMAIL PROTECTED] wrote: Nick Craig-Wood wrote: x += a does not equal x = x + a which it really should for all types of x and a Actually, this will *never* be the case for classes that do in-place augmented assignment. a = [1

Re: Forking SocketServer daemon -- updating state

2007-02-20 Thread Nick Craig-Wood
regularly? -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: f---ing typechecking

2007-02-20 Thread Nick Craig-Wood
reasonable counterexample ;-) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: 'import dl' on AMD64 platform

2007-02-19 Thread Nick Craig-Wood
John Pye [EMAIL PROTECTED] wrote: On Feb 19, 6:30 am, Nick Craig-Wood [EMAIL PROTECTED] wrote: John Pye [EMAIL PROTECTED] wrote: application from running on the Debian Etch AMD64 platform. It seems that the 'dl' module is not available on that platform. The only reason I need

Re: 'import dl' on AMD64 platform

2007-02-18 Thread Nick Craig-Wood
flags? Read stuff out of /usr/include/bits/dlfcn.h ? It seems to be a constant 1 anyway #define RTLD_LAZY 0x1 You could try compiling the dl module by hand. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Calling J from Python

2007-02-10 Thread Nick Craig-Wood
) ... * ** * * * * ** ** * * * * * * ** ** * * * * * * * * ** ** ** ** * * * * * * * * -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding cpu time spent on my program

2007-02-06 Thread Nick Craig-Wood
are about!) 4ms is the clock rate of this machine, ie 250 Hz. This is a compile time option for the linux kernel and is usually set in the range 100 Hz to 1000 Hz. The kernel doesn't measure CPU usage more accurately than this. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick

Re: assertions to validate function parameters

2007-01-27 Thread Nick Craig-Wood
: break old_delta = delta return total arctan(0.5) 0.46364760900080587 arctan(Decimal(0.5)) Decimal(0.4636476090008061162142562314) -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list

Re: How to use time.clock() function in python

2007-01-23 Thread Nick Craig-Wood
() 7.32428004118 1169574542.15 In windows clock() counts in real time and at much higher resolution than time(). Under windows time() counts in 1ms steps wheras it usually counts in 1us steps under linux. -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http

<    2   3   4   5   6   7   8   9   10   11   >