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 > interes

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 > > > > > > ... > > > > > >

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/ps

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

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

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 pre

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

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 you

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 >

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 whic

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! -- htt

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

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: ... F

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 st

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.htm

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 pyth

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

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 s

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 t

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

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 void bar() { printf("Hello! C wrap!"); } static PyObject *foo_bar(PyObject *self, PyObject *args) { /* Do something interesting here. */ bar(); Py_RETURN_NONE; } static PyMethod

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 alw

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 indi

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 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 incl

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

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 o

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

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 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 w

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 telne

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 filters

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 w

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

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://mail.python.

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 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 character

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 dea

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 int

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.", 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.pop

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 setdefaulttim

Re: Python CGI Scripting Documentation

2006-07-03 Thread Vlad Dogaru
Alex Martelli wrote: 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, Vlad. --

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 bo

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.", 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 m

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 extensi

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 ? -- 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 wr

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 ", proggie); > } > > int > main(int argc, char **argv) > { > struct in_addr addr; > > if (argc != 2 || !inet_aton(argv[1], &addr)) { > usage(argv[0]); > } > > (void)printf

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 || !inet_aton(argv

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 #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ipschema.h" #include "ssrv/sockaddr.h" #ifndef lint __RCSID("$Id: ethip.c 2314 2004-12-29 01:00:25Z dyoung $"); #endif #define ETHIP "ethip" #defi

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

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?

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 wil

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 attemp

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 seperat

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

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) = obj.metho

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 > p

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 w

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 t

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) >

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

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

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Bruno Desthuilliers
Vusi wrote: > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > #include > > #include "ipschema.h" > #include "ssrv/sockaddr.h" > > #ifndef lint > __RCSID("$Id: ethip.c 2314 2004-12-29 01:00

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 l

Re: Program analysis (pseudocode if possible)

2006-07-03 Thread Paul McGuire
"Bruno Desthuilliers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > > 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") > E

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 basic

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-AC

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] > > >> >> >>BEGIN PROGRAM >> read_this('http://www.catb.org/~esr/faqs/smart-questions.html') >> do_your_homework() > > if (cant_figure_it_out) BEGIN >post_specifi

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 cl

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 b

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

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 w

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 sing

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

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 Wind

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 experien

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 keepaliv

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 tupl

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 tup

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 gmail.com> Subject: weakattr Newsgroups: gmane.comp.python.devel D

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. Specifical

Re: xpath question

2006-07-03 Thread Simon Forman
[EMAIL PROTECTED] wrote: > bruce wrote: > > is there anyone with XPath expertise here? i'm trying to figure out if > > there's a way to use regex expressions with an xpath query? i've seen > > references to the ability to use regex and xpath/xml, but i'm not sure how > > to do it... > > > > i have

Re: Turning a callback function into a generator

2006-07-03 Thread Kirk McDonald
Alex Martelli wrote: > 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?

Re: list comprehension

2006-07-03 Thread Simon Forman
[EMAIL PROTECTED] wrote: > 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] The zip built-in fun

Re: For a fast implementation of Python

2006-07-03 Thread John Roth
Alex Martelli wrote: > [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 script

Re: For a fast implementation of Python

2006-07-03 Thread Luis M. González
. wrote: > What is the fast way for a fast implementation of Python? > > -- > JavaScript implementation of Python > http://groups.google.it/group/JSython/ Check this out: http://codespeak.net/pypy/dist/pypy/doc/news.html -- http://mail.python.org/mailman/listinfo/python-list

inline metaclasses

2006-07-03 Thread gangesmaster
just something i thought looked nice and wanted to share with the rest of you: >>> class x(object): ... def __metaclass__(name, bases, dict): ... print "hello" ... return type(name, bases, dict) ... hello >>> instead of defining a separate metaclass function/class, you

  1   2   >