Re: list comprehension

2006-07-03 Thread a
hey guys this is gr8 but in cheetah i use for test in $ix $test.url end for to iterate thru loop now how do i iterate feed_list and feed_id along with i, thanks a lot N = [(ix.url, ix.id) for ix in feeds_list_select] feed_list, feed_id = zip(*N) or just feed_list, feed_id = zip(*[(ix.url,

Tkinter function variable passing

2006-07-03 Thread arvind
How to pass the variables defined inside the function to the another function on click event of the button in Tkinter? pleas send me a sample code if anybody has it. thanx -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], valpa [EMAIL PROTECTED] wrote: I'm a net admin for about 20 unix servers, and I need to frequently telnet on to them and configure them. It is a tiring job to open a xterm and telnet, username, password to each server. Do you need to replicate identical

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], placid [EMAIL PROTECTED] wrote: Jim Segrave wrote: Don't use telnet. it's clumsy and has security issues. if youre behind a firewall then it shouldnt matter. Still not a good idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: On 2/07/2006 3:48 PM, Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: -u unbuffers sys.stdout and sys.stderr (and makes them binary, which wouldn't be a good idea on a

Re: Tkinter function variable passing

2006-07-03 Thread Fredrik Lundh
arvind wrote: How to pass the variables defined inside the function to the another function on click event of the button in Tkinter? def the_function(master): variable = ... def callback(): print variable b = Button(master, command=callback) /F

Re: Turning a callback function into a generator

2006-07-03 Thread Peter Otten
Kirk McDonald wrote: Let's say I have a function that takes a callback function as a parameter, and uses it to describe an iteration: def func(callback): for i in [1, 2, 3, 4, 5]: callback(i) For the sake of argument, assume the iteration is something more interesting

Re: conecting with a MsAcces DB by dao

2006-07-03 Thread luis
Iain King ha escrito: luis wrote: Iain King ha escrito: luis wrote: Iain King ha escrito: luis wrote: while not rs.EOF: id=rs.Fields(colName.Value) #colName, valid column name ... rs.MoveNext() rs.Close()

connect not possible to Oracle Datenbank as sysdba?

2006-07-03 Thread Cihal Josef
Hi, how can I connect to oracle database as SYSDBA as usually: "sqlplus anc/psw as sysdba" It is a parsing problem? (blanks,etc.?) or it is not implmented in DCOracle2? DCOracle.Connect('user/psw as sysdba') - NOK normal (without sysdba clause) - DCOracle.Connect('user/psw') - OK

For a fast implementation of Python

2006-07-03 Thread .
What is the fast way for a fast implementation of Python? -- JavaScript implementation of Python http://groups.google.it/group/JSython/ -- http://mail.python.org/mailman/listinfo/python-list

Re: connect not possible to Oracle Datenbank as sysdba?

2006-07-03 Thread Gerhard Häring
Cihal Josef wrote: Hi, how can I connect to oracle database as SYSDBA as usually: sqlplus anc/psw as sysdba It is a parsing problem? (blanks,etc.?) or it is not implmented in DCOracle2? [...] From a quick glance at the code, it does not seem like it is implemented in DCOracle2,

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread John Machin
On 3/07/2006 4:45 PM, Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: On 2/07/2006 3:48 PM, Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: -u unbuffers sys.stdout and sys.stderr (and makes

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread [EMAIL PROTECTED]
agreed, SSH is advisable over telnet in nearly all situations. However, there are a few times where telnet is better. 1. Embeded machines often have stripped down OS's. Telnet is much smaller and cheaper than a full blown SSH install. When every byte counts, you wont find SSH 2. He may have a

Re: For a fast implementation of Python

2006-07-03 Thread Bruno Desthuilliers
. wrote: What is the fast way for a fast implementation of Python? Please define fast. -- bruno desthuilliers python -c print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p in '[EMAIL PROTECTED]'.split('@')]) -- http://mail.python.org/mailman/listinfo/python-list

Re: how to stop python...

2006-07-03 Thread John Machin
On 3/07/2006 2:27 PM, bruce wrote: hi... perl has the concept of die. does python have anything similar. how can a python app be stopped? the docs refer to a sys.stop.. but i can't find anything else... am i missing something... Inter alia, sys.exit() and a functional Shift key. --

Re: I have 100 servers which need a new backup server added to a text file, and then the backup agent restarted.

2006-07-03 Thread [EMAIL PROTECTED]
Hehe, yeah, it does feel like swearing =) That solution works, as long as the network behaves PERFECTLY and you've allready configured the server to use your SSH key instead of a password. Expect, by its nature, waits until the right time to say things Sample pexpect code: - Code

Re: Dictionary .keys() and .values() should return a set [with Python3000 in mind]

2006-07-03 Thread [EMAIL PROTECTED]
Yes, this is what he's saying. Its not broken, just a bit different. After all, you dont have a problem with: lst = [1, 2, 3] ptr = lst lst.append(4) # this changes ptr And a view of the dictionary is orders faster than creating a copy of it (which is required to keep k0 from changing in your

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Nicko
placid wrote: Jim Segrave wrote: In article [EMAIL PROTECTED], valpa [EMAIL PROTECTED] wrote: I'm a net admin for about 20 unix servers, and I need to frequently telnet on to them and configure them. It is a tiring job to open a xterm and telnet, username, password to each server.

Re: For a fast implementation of Python

2006-07-03 Thread [EMAIL PROTECTED]
Psyco does some JIT compiling of Python, supposedly making it faster. You do need to think a bit, however, beforehand. If you really thing that the speed of execution is important for your application, a scripting language such as python may be the wrong tool. A language such as C++ or Java which

Re: how to stop python...

2006-07-03 Thread [EMAIL PROTECTED]
Wow, so many people with the same solution... where's the creativity folks? Whenever sys.exit() doesn't work for me, I find that a good solid thump on the side of the computer case with a large mallet tends to do the job. And there's always threatening the computer with a degaussing gun! --

Re: Dictionary .keys() and .values() should return a set [with Python3000 in mind]

2006-07-03 Thread Paul Rubin
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: And a view of the dictionary is orders faster than creating a copy of it (which is required to keep k0 from changing in your example). If you're LUCKY, copying a dictionary is O(n), There are ways to do it so you don't have to copy, but the dict

Threads and time.strptime()

2006-07-03 Thread Maximilian Michel
Hi all, I have an interesting problem: I have written code, that reads a logfile and parses it for date string (Thu Jun 29 14:01:23 2006). Standalone everthing works fine, all is recognized. But if I let the same code run in a thread, with the same file as input I get the following error: ...

Re: Dictionary .keys() and .values() should return a set [with Python3000 in mind]

2006-07-03 Thread [EMAIL PROTECTED]
Ooh, can you point me to them? This sounds very interesting. The only way I can think of doing it is to have some fun with pointers and not make the final copy until a change is made to the table. I'd love to read about an algoritm which can get around this! I feel so behind in the times, I

Re: PyPy and constraints

2006-07-03 Thread Paddy
Paddy wrote: Ziga Seilnacht wrote: Paddy wrote: I followed the recent anouncement of version 0.9 of PyPi and found out that there was work included on adding constraint satisfaction solvers to PyPy: http://codespeak.net/pypy/dist/pypy/doc/howto-logicobjspace-0.9.html I was

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread [EMAIL PROTECTED]
I may be wrong, but I've never heard of Windows being fully posix compliant. I guarentee you that they dont support pthreads. It is possible that by posix compliant the marketting execs mean supports all posix commands which dont interfere with our way of doing things Windows version of python

Re: No error while sending via TCP Socket

2006-07-03 Thread Ben Sizer
Grant Edwards wrote: On 2006-06-30, Martin Bürkle [EMAIL PROTECTED] wrote: I have writen a programm using TCP sockets. After i get the connection to another socket I cut the Ethernet cable. Then I send a message. The program doesnt raise any exception. Can somebody tell me why Because

Extending built-in objects/classes

2006-07-03 Thread Jon Clements
Hi All, I've reached the point in using Python where projects, instead of being like 'batch scripts', are becoming more like 'proper' programs. Therefore, I'm re-designing most of these and have found things in common which I can use classes for. As I'm only just starting to get into classes, I

Re: No error while sending via TCP Socket

2006-07-03 Thread [EMAIL PROTECTED]
Q: I have been looking through Volume 1 2 on the topics of TCP timeouts. I have been looking in the section on Timeout And Retransmission where you talk about round trip times. My question to you would be what would make a tcp connection timeout? Is there a certain number of retries that need to

Re: Numeric help!

2006-07-03 Thread Sheldon
Carl Banks wrote: Sheldon wrote: average(compress(ravel(equal(wk,z)),ravel(sattmp)),axis=None) This is much more compact and elegant. Thanks for pointing this out. I don't know why average() returned a divide by zero error and to avoid this I inserted this if statement. Now it works

Problem when import C model

2006-07-03 Thread [EMAIL PROTECTED]
Hi, all I am learning how to import c code in python. Here is my simple code foo.c: = #include Python.h void bar() { printf(Hello! C wrap!); } static PyObject *foo_bar(PyObject *self, PyObject *args) { /* Do something interesting here. */ bar(); Py_RETURN_NONE; } static

Re: how to stop python...

2006-07-03 Thread Paul Rubin
[EMAIL PROTECTED] [EMAIL PROTECTED] writes: Wow, so many people with the same solution... where's the creativity folks? Whenever sys.exit() doesn't work for me, I find that a good solid thump on the side of the computer case with a large mallet tends to do the job. And there's always

Re: Problem when import C model

2006-07-03 Thread [EMAIL PROTECTED]
this is more of a linux question than a python question, so you may get better luck with asking there. What you describe makes perfect sense to me. If python is a 64 bit program, it can only link to 64 bit libraries. If you compiled your library in 32-bit mode, then the library headers will

Re: Extending built-in objects/classes

2006-07-03 Thread [EMAIL PROTECTED]
My experiance is mostly with old-style classes, but here goes. first off, the what question is actually easier than you think. After all, self is an instance of a string, so self[3:4] would grab the slice of characters between 3 and 4 =) as for __init__, what I have found is that if you do not

Re: Dictionary .keys() and .values() should return a set [withPython3000 in mind]

2006-07-03 Thread [EMAIL PROTECTED]
You bring up a good point. the for x in d: notation is a relativly new construction, for x in d.keys() is much older. Some of the value of d.keys() goes away because we have this new construction, but there's some reasons to keep it around: 1. Consitency. You can get the values, you can get the

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread valpa
Thanks, But I need to to do complicated job in the xterm consoles for servers. So I need to open many xterm consoles and I just want to save my time from telneting...usr/pwd... Network Ninja wrote: valpa wrote: I'm a net admin for about 20 unix servers, and I need to frequently telnet on to

Re: Turning a callback function into a generator

2006-07-03 Thread [EMAIL PROTECTED]
Peter Otten wrote: Kirk McDonald wrote: Let's say I have a function that takes a callback function as a parameter, and uses it to describe an iteration: def func(callback): for i in [1, 2, 3, 4, 5]: callback(i) Which object is immutable? the callback or the

Re: Extending built-in objects/classes

2006-07-03 Thread Jon Clements
[EMAIL PROTECTED] wrote: My experiance is mostly with old-style classes, but here goes. first off, the what question is actually easier than you think. After all, self is an instance of a string, so self[3:4] would grab the slice of characters between 3 and 4 =) That's kind of funky - I

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread [EMAIL PROTECTED]
I can get to my code on wednesday, I'll upload it somewhere you can get a copy of it. But do look into using SSH, because in the long run it is a far better tool. A properly configured SSHD also opens the way to scp. Without scp, copying files means ftp, or unsecured rsync. Do you want tabbed

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread valpa
I don't care about security issue by now :), because every one in my compony know the username/password. It's a shared password. I just want to login into Unix boxes in an efficiently. so I needn't open a xterm console and type telent . usr/pwd for a unix box, and open another xterm, type

Re: list comprehension

2006-07-03 Thread [EMAIL PROTECTED]
I woulkdn't interate at the same time. zip takes two lists, and makes a single list of tuples, not the other way around. The easilest solution is feed_list = [ix.url for ix in feeds_list_select] feed_id = [ix.id for ix in feeds_list_select] Also, a big feature of list comprehension is it

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Paul Rubin
valpa [EMAIL PROTECTED] writes: Can I do it automatically by python? After that, there have 20 xterm consoles opened and telneted to their corresponding servers. Then I could start to type command in these xterms. Have python launch xterm -e somecommand for each server. somecommand would

Re: Tkinter function variable passing

2006-07-03 Thread arvind
Hi thanx for replynig. but functios are independent and the button is inside one of the functions. will u please reshape ur code and send it to me? thank u. Fredrik Lundh wrote: arvind wrote: How to pass the variables defined inside the function to the another function on click event of the

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: On 3/07/2006 4:45 PM, Lawrence D'Oliveiro wrote: I thought Windows (the NT line) was POSIX-compliant. What on earth gave you that idea? http://fuckinggoogleit.com/?query=windows+nt+posix --

Re: Extending built-in objects/classes

2006-07-03 Thread John Machin
On 3/07/2006 7:55 PM, Jon Clements wrote: [EMAIL PROTECTED] wrote: My experiance is mostly with old-style classes, but here goes. first off, the what question is actually easier than you think. After all, self is an instance of a string, so self[3:4] would grab the slice of characters

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], valpa [EMAIL PROTECTED] wrote: I don't care about security issue by now :), because every one in my compony know the username/password. Then why bother with a password at all? -- A: Skid-marks in front of the hedgehog. Q: What's the difference between a dead

Re: Turning a callback function into a generator

2006-07-03 Thread Lawrence D'Oliveiro
In article [EMAIL PROTECTED], Kirk McDonald [EMAIL PROTECTED] wrote: I want to somehow, in some way, provide an iteration interface to this function. Thoughts? Run it in a separate thread/process? -- http://mail.python.org/mailman/listinfo/python-list

catching syntax errors via excepthook?

2006-07-03 Thread Hari Sekhon
I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something sys.excepthook=myexcepthook rest of script (now protected by catchall exception hook) I've been intentionally

Re: Time out question

2006-07-03 Thread DarkBlue
Sure, see function setdefaulttimeout in module socket. Just call it as you wish before trying the DB connection and catch the resulting exception. Alex That should do it. Thanks Db -- http://mail.python.org/mailman/listinfo/python-list

Re: sys.stdin and two CTRL-Ds

2006-07-03 Thread John Machin
On 3/07/2006 9:14 PM, Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], John Machin [EMAIL PROTECTED] wrote: On 3/07/2006 4:45 PM, Lawrence D'Oliveiro wrote: I thought Windows (the NT line) was POSIX-compliant. What on earth gave you that idea?

Re: Extending built-in objects/classes

2006-07-03 Thread Jon Clements
John Machin wrote: (snip) You have already been told: you don't need self.what, you just write self ... self *is* a reference to the instance of the mystr class that is being operated on by the substr method. (snip) I get that; let me clarify why I asked again. As far as I'm aware, the

Re: slow non-blocking reads

2006-07-03 Thread Mark Dufour
interestingly, leaving out the fcntl stuff makes it work much faster. it seems to block only sometimes now, for just a moment, but on the whole the performance is acceptable now. On 6/29/06, Mark Dufour [EMAIL PROTECTED] wrote: hello all, I am trying to fire up a child process using os.popen2,

Re: Time out question

2006-07-03 Thread Nick Craig-Wood
Alex Martelli [EMAIL PROTECTED] wrote: DarkBlue [EMAIL PROTECTED] wrote: try for 10 seconds if database.connected : do your remote thing except raise after 10 seconds abort any connection attempt do something else Sure, see function setdefaulttimeout in module

Re: Python CGI Scripting Documentation

2006-07-03 Thread Vlad Dogaru
Alex Martelli wrote: snip Wow, I'm new in the field, but even I know your name. It's truly inspiring to be aswered to by you. Thank you, all of you, for your suggestions. I will try to look into the matter using the starting points you've given me, as well as read more about Django. Thanks,

HTPPD eror on red hot linux

2006-07-03 Thread donxfabio
Help me Syntax error on line 189 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_unique_id.so into server: /etc/httpd/modules/mod_unique_id.so: ELF file's phentsize not the expected size Whats this? -- http://mail.python.org/mailman/listinfo/python-list

Out of the box database support

2006-07-03 Thread Alex Biddle
Hey there. I was wondering whether Python had any support out-of-the-box for database functionality, or database-like functionality. For instance a lot of shared hosts have Python installed, but not the MySQL extension, the flexible of these would install it, but most of the time they wouldn't

Re: Extending built-in objects/classes

2006-07-03 Thread John Machin
On 3/07/2006 10:01 PM, Jon Clements wrote: John Machin wrote: (snip) You have already been told: you don't need self.what, you just write self ... self *is* a reference to the instance of the mystr class that is being operated on by the substr method. (snip) I get that; let me clarify

Re: Out of the box database support

2006-07-03 Thread Jean-Paul Calderone
On Mon, 3 Jul 2006 13:41:24 +0100, Alex Biddle [EMAIL PROTECTED] wrote: Hey there. I was wondering whether Python had any support out-of-the-box for database functionality, or database-like functionality. For instance a lot of shared hosts have Python installed, but not the MySQL extension, the

Can anyone please analyse this program for me (write a pseudocode for it).

2006-07-03 Thread Vusi
/* $Id: dotquad.c 3529 2005-10-01 10:15:22Z dyoung $ */ /* * Copyright (c) 2003, 2004 David Young. All rights reserved. * * This code was written by David Young. * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following

Re: Tkinter function variable passing

2006-07-03 Thread Fredrik Lundh
arvind [EMAIL PROTECTED] wrote: thanx for replynig. but functios are independent and the button is inside one of the functions. will u please reshape ur code and send it to me? where do I send the invoice ? /F -- http://mail.python.org/mailman/listinfo/python-list

Re[2]: Can I do it using python?? about xterm and telnet

2006-07-03 Thread Petr Jakeš
v Thanks, v But I need to to do complicated job in the xterm consoles for servers. what does it mean, complicated job? Can you be more specific, please? v So I need v to open many xterm consoles and I just want to save my time from v telneting...usr/pwd... v Network Ninja wrote: valpa wrote:

Re: Can anyone please analyse this program for me (write a pseudocode for it).

2006-07-03 Thread BJörn Lindqvist
void usage(const char *proggie) { errx(EXIT_FAILURE, Usage: %s ip address, proggie); } int main(int argc, char **argv) { struct in_addr addr; if (argc != 2 || !inet_aton(argv[1], addr)) { usage(argv[0]); } (void)printf(%s\n,

Re: Can anyone please analyse this program for me (write a pseudocode for it).

2006-07-03 Thread Tim Chase
/* $Id: dotquad.c 3529 2005-10-01 10:15:22Z dyoung $ */ Well, let's begin here. You've got your python commenting style all wrong. This alone won't parse as python. I recommend using the standard # comment notation as described in the python docs. if (argc != 2 ||

Re: HTPPD eror on red hot linux

2006-07-03 Thread gregarican
Ever read Flowers for Algernon? Just curious... donxfabio wrote: Help me Syntax error on line 189 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_unique_id.so into server: /etc/httpd/modules/mod_unique_id.so: ELF file's phentsize not the expected size Whats this? --

Program analysis (pseudocode if possible)

2006-07-03 Thread Vusi
#include err.h #include stdlib.h #include string.h #include sys/ioctl.h #include sys/types.h #include sys/socket.h #include net/route.h #include net/if.h #include netinet/in.h #include arpa/inet.h #include net/if_ether.h #include net/if_dl.h #include ifaddrs.h #include stdio.h #include ipschema.h

Re: No error while sending via TCP Socket

2006-07-03 Thread Grant Edwards
On 2006-07-03, Ben Sizer [EMAIL PROTECTED] wrote: and give me a hint how to get an exception You can't -- unless you've enabled the keepalive option on the TCP connection and you've waited the requisite time after the cable is cut before sending your data (IIRC it takes a couple hours for

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread valpa
telnet server must have a password, right? Lawrence D'Oliveiro wrote: In article [EMAIL PROTECTED], valpa [EMAIL PROTECTED] wrote: I don't care about security issue by now :), because every one in my compony know the username/password. Then why bother with a password at all? -- A:

Re: Problem when import C model

2006-07-03 Thread Nick Craig-Wood
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: What you describe makes perfect sense to me. If python is a 64 bit program, it can only link to 64 bit libraries. If you compiled your library in 32-bit mode, then the library headers will indicate this, and linux's library loading code will

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Diez B. Roggisch
http://www.catb.org/~esr/faqs/smart-questions.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Time out question

2006-07-03 Thread Grant Edwards
On 2006-07-03, Nick Craig-Wood [EMAIL PROTECTED] wrote: Alex Martelli [EMAIL PROTECTED] wrote: DarkBlue [EMAIL PROTECTED] wrote: try for 10 seconds if database.connected : do your remote thing except raise after 10 seconds abort any connection attempt do something

Re: Can I do it using python?? about xterm and telnet

2006-07-03 Thread valpa
Maybe I'm not state what I want clearly. These Unix boxes are not doing important job like email, web server, etc. In our lab, these unix boxes are connected to be a network system to run our protocols and our job is to test the protocols. they are physically seperated from lab network and

Re: image output in matplotlib

2006-07-03 Thread John Hunter
mart == mart jeeha [EMAIL PROTECTED] writes: mart Hey folks, I got a problem in printing images from a mart matplotlib - FigureCanvas Object (child of a wxFrame, mart library backend_wx) into jpeg-formatted files. (I like to mart create a sequence of images that I can assemble to

Classes and global statements

2006-07-03 Thread Sheldon
Hi, I have a series of classes that are all within the same file. Each is called at different times by the main script. Now I have discovered that I need several variables returned to the main script. Simple, right? I thought so and simply returned the variables in a tuple: (a,b,c,d,e) =

RE: Event objects Threading on Serial Port on Win32

2006-07-03 Thread el cintura partida
Muchas gracias Gabriel por haberme informado, vos si que es un profesional de la programación. Un saludo, David --- Gabriel [EMAIL PROTECTED] escribió: David: Tube el mismo problema que vos con el hilo del ejemplo de pyserial. Me paso que en Linux andaba bien, obvio, pero tenia un pequeño

Re: Python CGI Scripting Documentation

2006-07-03 Thread per9000
Hi, I wanted to try this myself a few days ago, my first (working) try had this source code: --- #!/usr/bin/python print 'Content-Type: text/plain' print print 'hell o world' --- (the output is just hell o world\n, but the first four lines are still required I guess, I don't know why, but it

Re: Dictionary .keys() and .values() should return a set [with Python 3000 in mind]

2006-07-03 Thread Piet van Oostrum
Paddy [EMAIL PROTECTED] (P) wrote: P [EMAIL PROTECTED] wrote: This has been bothering me for a while. Just want to find out if it just me or perhaps others have thought of this too: Why shouldn't the keyset of a dictionary be represented as a set instead of a list? P I think the order of the

Re: Time out question

2006-07-03 Thread Rune Strand
Grant Edwards wrote: I just use signal.alarm(): import signal,sys def alarmHandler(signum, frame): raise 'Timeout' signal.signal(signal.SIGALRM, alarmHandler) while 1: try: signal.alarm(5) t = sys.stdin.readline() signal.alarm(0) print t

Controlling Windows Media Player from Python

2006-07-03 Thread Jeffrey Barish
Is there a way to interact with Windows Media Player from Python? I would like to be able to do things like tell WMP to play a given sound file or to ask WMP for metadata about a sound file. -- Jeffrey Barish -- http://mail.python.org/mailman/listinfo/python-list

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
[EMAIL PROTECTED] wrote: Peter Otten wrote: Kirk McDonald wrote: Let's say I have a function that takes a callback function as a parameter, and uses it to describe an iteration: def func(callback): for i in [1, 2, 3, 4, 5]: callback(i) Which object is immutable? the

Re: Controlling Windows Media Player from Python

2006-07-03 Thread Avizoa
Jeffrey Barish wrote: Is there a way to interact with Windows Media Player from Python? I would like to be able to do things like tell WMP to play a given sound file or to ask WMP for metadata about a sound file. -- Jeffrey Barish The fact of the matter is that python doesn't need to ask

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Bruno Desthuilliers
Vusi wrote: #include err.h #include stdlib.h #include string.h #include sys/ioctl.h #include sys/types.h #include sys/socket.h #include net/route.h #include net/if.h #include netinet/in.h #include arpa/inet.h #include net/if_ether.h #include net/if_dl.h #include ifaddrs.h #include

email.Message.get_payload() surprising behavior

2006-07-03 Thread lrotger
The behavior of get_payload() is different when the quoted-printable text has \n line endings or \r\n line endings. If it's \n and the last byte of a line in that file is 0x0D it confuses them for a \r\n line ending and strips both bytes. This behavior does not occur if the same file has \r\n

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Paul McGuire
Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip pseudocode BEGIN PROGRAM read_this('http://www.catb.org/~esr/faqs/smart-questions.html') do_your_homework() if (cant_figure_it_out) post_specific_question_on_relevant_newsgroup(comp.lang.c)

Re: Out of the box database support

2006-07-03 Thread Alex Biddle
Hey, thanks for the reply Jean-Paul. That's pretty cool knowing that Python 2.5 will have it out of the box, however what about basic out-of-the-box functionality in 2.4 (or even older)? In all my other experiences Python comes with a lot of tools already available, it seems odd not to have

Re: No error while sending via TCP Socket

2006-07-03 Thread Ben Sizer
Grant Edwards wrote: You're talking about the case where there's un-ACKed data. Breaking a link when there's no un-ACKed data (which is what the OP did) will require an hour or two to timeout _iff_ keepalive is enabled. If keepalive has not been enabled, a broken connection with no un-ACKed

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Bruno Desthuilliers
Paul McGuire wrote: Bruno Desthuilliers [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] snip pseudocode BEGIN PROGRAM read_this('http://www.catb.org/~esr/faqs/smart-questions.html') do_your_homework() if (cant_figure_it_out) BEGIN

Re: list comprehension

2006-07-03 Thread Bruno Desthuilliers
a wrote: hi simon thanks for your reply what if i want to do this feed_list=[] feed_id=[] for ix in feeds_list_select: global feeds_list global feeds_id Learn how to avoid globals first. -- bruno

Re: conecting with a MsAcces DB by dao

2006-07-03 Thread Scott David Daniels
luis wrote: My problem was opening a query (not a table) on mdb file 1) If the query includes a where clause type field1=edf and field2=3 , for example, no problem, Access can retrieve a not empty recordset and my python code too. 2) But if the Access's query includes a LIKE clause, for

Re: For a fast implementation of Python

2006-07-03 Thread Alex Martelli
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Psyco does some JIT compiling of Python, supposedly making it faster. You do need to think a bit, however, beforehand. If you really thing that the speed of execution is important for your application, a scripting language such as python may be the

Re: catching syntax errors via excepthook?

2006-07-03 Thread Alex Martelli
Hari Sekhon [EMAIL PROTECTED] wrote: I've written an except hook into a script as shown below which works well for the most part and catches exceptions. import sys def myexcepthook(type,value,tb): do something sys.excepthook=myexcepthook rest of script (now protected by

Re: Out of the box database support

2006-07-03 Thread Alex Martelli
Alex Biddle [EMAIL PROTECTED] wrote: Hey there. I was wondering whether Python had any support out-of-the-box for database functionality, or database-like functionality. For instance a lot of shared hosts have Python installed, but not the MySQL extension, the flexible of these would

Embedded python problem

2006-07-03 Thread Robin Becker
We have a client using a fully embedded python in a large DTP app. It used to be Mac OS 9/X only, but the MAC 9 support has gone away and we now have support for the PC with the embedding being used in C# via external DLL aliasing/marshalling etc etc. The embedding DLL has effectively a

Re: Out of the box database support

2006-07-03 Thread Alex Biddle
Ah, so separate downloads then. At least now I know. Ergh... I checked the version of Python my current host is running and its 2.2. ...ergh On 7/3/06, Alex Martelli [EMAIL PROTECTED] wrote: Python 2.5's standard library includes pysqlite. For any other DB, or any previous release of

Re: conecting with a MsAcces DB by dao

2006-07-03 Thread Tim Chase
, Access can retrieves a not empty recordset but my python code retrieves a empty recordset. Which is exactly what it _should_ return on that query, unless you have records with e* in column field1. The proper SQL clause is: ... WHERE field1 LIKE 'e*' ... which would also return

Re: Out of the box database support

2006-07-03 Thread BartlebyScrivener
I guess you looked here without finding what you want? http://www.python.org/doc/topics/database/ What's the big deal with out of the box? People have different tastes in dbs and ways to access them, why not just pick the one you want and download it? You didn't say if you are on Linux or

Re: Out of the box database support

2006-07-03 Thread Paul McGuire
Alex Biddle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hey, thanks for the reply Jean-Paul. That's pretty cool knowing that Python 2.5 will have it out of the box, however what about basic out-of-the-box functionality in 2.4 (or even older)? In all my other experiences Python

Re: No error while sending via TCP Socket

2006-07-03 Thread Grant Edwards
On 2006-07-03, Ben Sizer [EMAIL PROTECTED] wrote: Grant Edwards wrote: You're talking about the case where there's un-ACKed data. Breaking a link when there's no un-ACKed data (which is what the OP did) will require an hour or two to timeout _iff_ keepalive is enabled. If keepalive has not

Re: Classes and global statements

2006-07-03 Thread Simon Forman
Sheldon wrote: Hi, I have a series of classes that are all within the same file. Each is called at different times by the main script. Now I have discovered that I need several variables returned to the main script. Simple, right? I thought so and simply returned the variables in a tuple:

Re: Classes and global statements

2006-07-03 Thread Scott David Daniels
Sheldon wrote: Hi, I have a series of classes that are all within the same file. Each is called at different times by the main script. Now I have discovered that I need several variables returned to the main script. Simple, right? I thought so and simply returned the variables in a tuple:

suggestion: adding weakattr to stdlib

2006-07-03 Thread gangesmaster
three-liner: reposted from python-dev for more feedback. it suggests to add the weakattr class to the standard weakref.py module. comments are welcome. [ http://article.gmane.org/gmane.comp.python.devel/81875 ] From: tomer filiba tomerfiliba at gmail.com Subject: weakattr Newsgroups:

Re: Turning a callback function into a generator

2006-07-03 Thread Alex Martelli
Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], Kirk McDonald [EMAIL PROTECTED] wrote: I want to somehow, in some way, provide an iteration interface to this function. Thoughts? Run it in a separate thread/process? Sounds best to me. Specifically, given

  1   2   >