Re: Help with ctypes pointer return values

2006-09-11 Thread steve . horsley
Lawrence Oluyede wrote: [EMAIL PROTECTED] wrote: Does anyone have a good idea how I should define recordList so that I can retrieve the record pointers? POINTER(POINTER(c_void)) ? Maybe I misunderstood tough... That's interesting. It had not occurred to me that you could do that. And

Re: XPath/Screen Scraping Gurus..

2006-04-17 Thread Steve Horsley
Peter Hansen wrote: bruce wrote: I'm not that familiar with Pythin, but I wasn wondering if there are any XPath/Python Gurus that I might be able to talk to regarding screen scraping applications... Since you mention XPath, it seems likely you are really interested in *web-scraping*.

Re: Socket Error: Connection Refused

2006-04-17 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Dear c.l.p, I have recently been doing the tutorial of Python and everything is well, i'm upto the pass section. Anyway, when I try to launch idle now I get the error message: Socket Error: Connection Refused. I do not have a firewall, so I don't know what is

Re: is socket thread safe?

2006-02-15 Thread Steve Horsley
[EMAIL PROTECTED] wrote: thread1: while 1: buf = s.read() process(buf) thread2: while 1: buf = getdata() s.write(buf) It is safe, but watch out for this gotcha: If thread B calls s.close() while thread A is blocked in s.read(), thread A will

Re: how do you pronounce 'tuple'?

2006-02-13 Thread Steve Horsley
Paddy wrote: Its tupple surely. The following shows that we are not the first to ponder this: http://www.jot.fm/issues/issue_2003_03/column9 Stick tuple into the Windosw XP speech properties preview box and hit preview-voice, it says tupple not toople. :-) Which only goes to prove

Re: how to kill a python process?

2006-02-10 Thread Steve Horsley
MackS wrote: Hello! This question does not concern programming in python, but how to manage python processes. Is there a way to name a python process? At least on Linux, if I have two python programs running, they both run under the name python #pidof program1.py [empty line] #pidof

Re: Daemon terminates unexpected

2006-02-10 Thread Steve Horsley
Incorporating Fredrik's fix (I learned something new reading that), try using an endless loop even if there is an exception like this: def run(self): while True: try: start an SMTP-Server asyncore.loop() except:

Re: Python module for LX200 telescope command set

2006-01-30 Thread Steve Horsley
Terry Hancock wrote: On Sun, 29 Jan 2006 15:25:43 -0800 RayS [EMAIL PROTECTED] wrote: (about LX200 module) Sounds interesting, but I don't actually know what an LX200 is. I considered buying one of the Meade computer controlled telescopes (there is a very inexpensive one that has been

Re: Linux python file-I/O ?

2005-12-25 Thread Steve Horsley
[EMAIL PROTECTED] wrote: I've just started to test/learn python. I've got Linux mandrake9 python documentation. What I'll initially want to be doing needs file I/O, so I wanted to confirm file I/O early in my tests. Following the examples : f=open('/tmp/workfile', 'w') print f open

Re: UDP socket, need help setting sending port

2005-12-22 Thread Steve Horsley
Sells, Fred wrote: I'm using MSW XP Pro with Python 2.4 to develop but production will be Linux with Python 2.3. (could upgrade to 2.4 if absolutely necessary) I can also switch to Linux for development if necessary. I am writing some python to replace proprietary software that talks to a

Re: OO in Python? ^^

2005-12-16 Thread Steve Horsley
Matthias Kaeppler wrote: Hi, sorry for my ignorance, but after reading the Python tutorial on python.org, I'm sort of, well surprised about the lack of OOP capabilities in python. Honestly, I don't even see the point at all of how OO actually works in Python. For one, is there any

Re: PYTHON LOOSING FOR JAVA???????

2005-11-08 Thread Steve Horsley
Jarek Zgoda wrote: Computing is large area. Much larger than aunt Tilly's laptop. You clearly haven't seen the size of Aunt Tilly's lap! Sorry, couldn't resist it. Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Why the nonsense number appears?

2005-11-01 Thread Steve Horsley
Dan Bishop wrote: That's A source of error, but it's only part of the story. The double-precision binary representation of 0.039 is 5620492334958379 * 2**(-57), which is in error by 1/18014398509481984000. By contrast, Johnny Lee's answer is in error by 9/262144000, which is more than 618

Re: extracting numbers from a file, excluding words

2005-11-01 Thread Steve Horsley
Kristina Kudriašova wrote: 1 Nov 2005 09:19:45 -0800, [EMAIL PROTECTED] [EMAIL PROTECTED]: Hi, I have a file with this content: z zzz z ... xxx xx x 34.215 zzz zz ... Hi, I'd suggest doing this: f = file('...') for line in f: if

Re: Python's website does a great disservice to the language

2005-11-01 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Grant Edwards wrote: May God save us from professional looking web sites. I like the Python web site. It's simple, easy to read, and easy to use. I strongly agree with you, the web is full of web sites that are nice looking but have microscopic fixed fonts

Re: callback for ctypes

2005-11-01 Thread Steve Horsley
James Hu wrote: Hi, gurus, I would like to use ctypes to implement callback function for QImage Camera to capture image asynchronously, and I have the c++ code of callback, but I am totally in the dark, the ctypes tutorial is not good enough for me to do that, does someone know where to dig

Re: Problem With Insert with MySQLdb

2005-10-31 Thread Steve Horsley
David Mitchell wrote: Hello, I am a complete beginner with Python. I've managed to get mod_python up and running with Apache2 and I'm trying to a simple insert into a table in a MySQL database. I'm using the MySQLdb library for connectivity. I can read from the database no problem, but

Re: Why the nonsense number appears?

2005-10-31 Thread Steve Horsley
Ben O'Steen wrote: On Mon, October 31, 2005 10:23, Sybren Stuvel said: Ben O'Steen enlightened us with: Using decimal as opposed to float sorts out this error as floats are not built to handle the size of number used here. They can handle the size just fine. What they can't handle is 1/1000th

Re: newbie question about SocketServer

2005-10-21 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Is it just me or do the server_close() methods do squat? I'm primarily working with a ThreadingTCPServer object and trying to create a simple server that can shut itself down. But even simplest cases don't seem to work. Admittedly I am trying it from within my

Re: When someone from Britain speaks, Americans hear a British accent...

2005-10-09 Thread Steve Horsley
Steve Holden wrote: Steve Horsley wrote: [...] The one that always makes me grit my teeth is You have got to, don't you?. Well no, I do NOT got to, actually. Shudder! Shouldn't that be I don't have to got to? regards Steve Yes it should. -- http://mail.python.org/mailman/listinfo

Re: When someone from Britain speaks, Americans hear a British accent...

2005-10-08 Thread Steve Horsley
Steve Holden wrote: Then again, there's room for infinite disagreement about these topics. I mentioned a while ago that I disliked the English on a bumper sticker I liked, which read Some village in Texas is missing their idiot. Several people defended this, saying that a village could

Re: ASCII

2005-09-30 Thread Steve Horsley
Tuvas wrote: Is there a function that will take a char. and return the ascii value? Thanks! print ord('A') 65 Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: win32 service and time.sleep()

2005-09-22 Thread Steve Horsley
Oracle wrote: On Tue, 20 Sep 2005 10:49:13 -0400, rbt wrote: I have a win32 service written in Python. It works well. It sends a report of the status of the machine via email periodically. The one problem I have is this... while trying to send an email, the script loops until a send happens

Re: multithread exception handling

2005-09-19 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Hello. I have problem and I ask you for help. Probably there is some quite easy solution, but I can't see it. I'm trying to perform some action that have to be timeout safe. So here is the structure of my program: \\\ def

Re: Do thread die?

2005-09-17 Thread Steve Horsley
Maurice LING wrote: Hi, I just have a simple question about threads. My classes inherits from threading.Thread class. I am calling threading.Thread.run() method to spawn a few threads to parallel some parts of my program. No thread re-use, pooling, joining ... just plainly spawn a

Re: MySQLdb UPDATE does nothing

2005-09-16 Thread Steve Horsley
Magnus Lycka wrote: Steve Horsley wrote: Or, as I found out yesterday, cursor.execute('commit') afterwards. The correct way to do it is to close the cursor object, and then do db.commit(). Don't rely on a cursor object to work across transaction boundries! See e.g. www.thinkware.se

Re: MySQLdb UPDATE does nothing

2005-09-15 Thread Steve Horsley
Rowdy wrote: A similar question was asked back in July, someone posted this: quote If it's any help, using cursor.execute(set autocommit = 1) before doing anything else works nicely unless you actually need transactions. /quote Or, as I found out yesterday,

Re: Premature wakeup of time.sleep()

2005-09-12 Thread Steve Horsley
Erich Schreiber wrote: In the Python Library Reference the explanation of the time.sleep() function reads amongst others: The actual suspension time may be less than that requested because any caught signal will terminate the sleep() following execution of that signal's catching routine.

Re: ~ after script filename?

2005-09-07 Thread Steve Horsley
presentt wrote: Hello all, I just wrote a really simple script and named it helloworld.py. Inside was only: #!/usr/bin/env print Hello, world I used chmod to set the permissions, and ran it to see what happened (I just started learning Python, if you couldn't guess) Then, I typed

Re: determine if os.system() is done

2005-09-07 Thread Steve Horsley
Xah Lee wrote: suppose i'm calling two system processes, one to unzip, and one to “tail” to get the last line. How can i determine when the first process is done? Example: subprocess.Popen([r/sw/bin/gzip,-d,access_log.4.gz]); last_line=subprocess.Popen([r/usr/bin/tail,-n

Re: killing thread after timeout

2005-09-06 Thread Steve Horsley
Jacek Popławski wrote: Hello. I am going to write python script which will read python command from socket, run it and return some values back to socket. My problem is, that I need some timeout. I need to say for example: os.system(someapplication.exe) and kill it, if it waits

Re: defining classes

2005-09-02 Thread Steve Horsley
LeRoy Lee wrote: I have been searching for the answer to this as it will determine how I use classes. Here are two bits of code. class foo1: def __init__(self, i): self.r = i self.j = 5 h = foo1(1) h.r 1 h.j 5 Now take this example class foo2:

Re: SocketServer and a Java applet listener

2005-08-29 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Steve Horsley schreef: Probably the same problem. If you didn't send a 2 byte length indicator first, then java's readUTF() will have tried to interpret the first 2 bytes that you did actually send as the string length, and may well simply be waiting patiently

Re: SocketServer and a Java applet listener

2005-08-27 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Dear newsgroup, I give up, I must be overseeing something terribly trivial, but I can't get a simple (Java) applet to react to incoming (python) SocketServer messages. Without boring you with the details of my code (on request available, though), here is what I

Re: Scket connection to server

2005-06-30 Thread Steve Horsley
JudgeDread wrote: hello python gurus I would like to establish a socket connection to a server running a service on port 2. the host address is 10.214.109.50. how do i do this using python? many thanks Off the top of my head (so there could be errors): import socket s =

Re: Favorite non-python language trick?

2005-06-24 Thread Steve Horsley
Neat. Thank Goodness for syntax-colouring editors! Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Avoiding deadlocks in concurrent programming

2005-06-22 Thread Steve Horsley
Eloff wrote: Hi Paul, If the 100 threads are blocked waiting for the lock, they shouldn't get awakened until the lock is released. So this approach is reasonable if you can minimize the lock time for each transaction. Now that is interesting, because if 100 clients have to go through the

Re: a question from a newcomer to this language

2005-06-10 Thread Steve Horsley
Michael Chermside wrote: Shankar writes: Is there any way to convert a string into an instruction that will be executed? Short answer: Yes. The exec statement does what you want: x = 3 y = 4 exec z = x * y print z 12 Ooh! I didn't know that one. I have to admit that it gives

Re: maybe a bug in python

2005-06-05 Thread Steve Horsley
flyaflya wrote: a = {1: (a)} a[1] 'a' why not ('a')? when a = {1: (((a)))} a[1] 'a' the result is 'a' too,not (((a))).but when use[a] or (a,b),the tuple is longer than 1, it's no problem. To define a tuple literal with one member, you must place a comma after the first

Re: Mandrake 10.1 and Python 2.3.4

2005-05-15 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Hi Joal, I can only tell you that in my Linux Mandrake 10.1 (Community Edition), all is ok: Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux (Alpha 3.4.1-3mdk)] on linux2 Type help, copyright, credits or license for more information. import site

Re: Secure FTP

2005-04-27 Thread Steve Horsley
Daniel Bowett wrote: I need to download files over a secure channel. I have been looking into Paramiko which seems to have the functonality I need. The problem is I need a FTP server which supports key based encryption to install on my windows server. Has anyone succeeded in doing this? If so -

Re: Can a function be called within a function ?

2005-04-18 Thread Steve Horsley
Peter Moscatt wrote: Is it possible to write code and allow a function to be called within another like I have shown below ? Pete def populatelist(): f=open(_globals.appath + dxcluster.svr,r) while true: text = f.readline() if text ==:

Re: Is Python like VB?

2005-03-18 Thread Steve Horsley
scattered wrote: You are right that VBA isn't being discontinued yet. My own interest in learning python is to find a replacement for Excel VBA. I'm a mathematician who likes to throw quick programs together for things like statistical simulations. I liked the ability to get functioning code

Re: Unicode BOM marks

2005-03-13 Thread Steve Horsley
Martin v. Lwis wrote: Steve Horsley wrote: It is my understanding that the BOM (U+feff) is actually the Unicode character Non-breaking zero-width space. My understanding is that this used to be the case. According to http://www.unicode.org/faq/utf_bom.html#38 the application should now specify

Re: Unicode BOM marks

2005-03-09 Thread Steve Horsley
Francis Girard wrote: Le lundi 7 Mars 2005 21:54, Martin v. Lwis a crit : Hi, Thank you for your very informative answer. Some interspersed remarks follow. I personally would write my applications so that they put the signature into files that cannot be concatenated meaningfully (since the

Noob can't make threads work

2005-03-01 Thread Steve Horsley
I am trying to start two threads to do some time consuming work. This is my first stab at threading, and it isn't working as I expect. Instead of the threads starting when I call start(), they seem to run the target code as part of the constructor call. Here is my test code... #!/usr/bin/python

Re: Noob can't make threads work

2005-03-01 Thread Steve Horsley
Grant Edwards wrote: On 2005-03-01, Steve Horsley [EMAIL PROTECTED] wrote: I am trying to start two threads to do some time consuming work. This is my first stab at threading, and it isn't working as I expect. Instead of the threads starting when I call start(), they seem to run the target code

Re: [EVALUATION] - E02 - Support for MinGW Open Source Compiler

2005-02-14 Thread Steve Horsley
Stephen Kellett wrote: In message [EMAIL PROTECTED], Ilias Lazaridis [EMAIL PROTECTED] writes And yet there is not one company that has someone devoted full-time to developing Python. Not even Guido. Who's Guido? LOL Falling off my chair!! I think the expression you are looking for is

Re: check socket alive

2005-02-09 Thread Steve Horsley
[EMAIL PROTECTED] wrote: Dear all, following are some piece of my code (mainly create a socket connection to server and loop to receive data): snip # function to receive data def recv_for_sock(sock): sock.settimeout(25) while 1: if sock is None: return 1

Re: Is Python as capable as Perl for sysadmin work?

2005-02-09 Thread Steve Horsley
Jeff Epler wrote: If I want to beg my computer to run programs, I know where to find Intercal with its PLEASE and DO PLEASE constructions. Was it INTERCAL that had the COMEFROM Line number statement instead of GOTO? I REALLY like the idea of a COMEFROM statement. I think python should have a

Re: socket question

2005-02-07 Thread Steve Horsley
Philippe C. Martin wrote: Thanks you! that did it. That makes me wonder what socket.gethostname() was returning. It wasn't 'localhost', was it? Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: The limitation of the Photon Hypothesis

2005-01-08 Thread Steve Horsley
bill wrote: Please reply to [EMAIL PROTECTED], thank you ! No - I'll reply to the newsgroup, if you don't mind. The limitation of the Photon Hypothesis snip THE UNCERTAINTY PRINCIPLE IS UNTENABLE Big snip You cannot use classical theory to disprove quantum theory that easily. The uncertainty is

Re: tuples vs lists

2005-01-08 Thread Steve Horsley
worzel wrote: I get what the difference is between a tuple and a list, but why would I ever care about the tuple's immuutability? Mainly for security and speed. Many library functions return info by returning a reference to an internally held tuple, and could be damaged / compromised / corrupted

Re: A Fundamental Turn Toward Concurrency in Software

2005-01-07 Thread Steve Horsley
Jack Diederich wrote: On Fri, Jan 07, 2005 at 01:35:46PM -0800, aurora wrote: Hello! Just gone though an article via Slashdot titled The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software [http://www.gotw.ca/publications/concurrency-ddj.htm]. It argues that the continous