Re: subprocess leaves child living

2007-06-07 Thread reed
On Jun 5, 7:58 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: > Hi, When I do a small program like > > from subprocess import Popen > popen = Popen(["ping", "google.com"]) > from time import sleep > sleep(100) > > start it and kill it, the ping process lives on. > Is there a way to ensure that

Re: Tkinter, tkMessagebox and overrideredirect

2007-06-07 Thread marcoberi
On Jun 6, 3:38 pm, "Eric Brunel" <[EMAIL PROTECTED]> wrote: > My only advice would then be to avoid using the standard functions to > create dialog boxes, and to create them yourself. For example: > -- > from Tkinter import * [snip] > app.roo

Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread Gerard Flanagan
On Jun 7, 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: > Hi all, > I guess this question was asked many times before, but I don't know > keywords for web search. > > Thank you in advance, D. import os d1 = os.path.dirname(__file__) d2 = os.path.dirname(os.__file__) print d1 print d2 -- http://m

Calling Usergroup Organizers (and Wannabees)

2007-06-07 Thread Jeff Rush
We'd like to strengthen and raise the visibility of Python usergroups and foster the creation of new ones, by sharing the valuable experiences of those leaders around the community who make it happen. [1] One step is to make others more aware of what is already happening, perhaps in their own

Re: Does Boost.Python participate in cyclic gc?

2007-06-07 Thread Giovanni Bajo
On 05/06/2007 21.32, [EMAIL PROTECTED] wrote: > We encountered a situation today where it appeared that a > Boost.Python-provided class didn't participate in Python's cyclic garbage > collection. The wrapped C++ instance held a reference to a method in the > Python object which referenced the Boo

Re: MoinMoin configuration

2007-06-07 Thread Hendrik van Rooyen
"Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > (currently beating my head against flash memory and grub problems). So if you > come up with a solution, feel free to e-mail me directly or if you have any > other questions, also, feel free to send me mail. Might not know the answer but > at lea

Help a C++ escapee!

2007-06-07 Thread Simon Pickles
Hi, Can someone help me leave the murky c++ world and enter shiny pythonland? I have a problem with importing and global variables, here's my code: ##server.py #socket connections from socketManager import* network = CNetworkManager() network.Listen()

RE: MySQL InterfaceError

2007-06-07 Thread Joe
> Try passing the cursor and not the connection - Unfortunately this provided the same InterfaceError. It was one of the first options we had tried in correcting the situation. Is there any way to check on the status of a database connection (like an isOpen() method)? It appeared as though the

Multithreaded PyGtk application problems

2007-06-07 Thread lost script
I needed a thread which will run in background , collect some information from other hosts and save info in database periodically. While gtk thread will show the collected information from database. It works but gtk response is too slow. Can anyone help or give any link of such a sample applicati

Re: Basic Auth for simple web server

2007-06-07 Thread Marco Aloisio
Thanks -- Marco Aloisio -- http://mail.python.org/mailman/listinfo/python-list

Integer division

2007-06-07 Thread [EMAIL PROTECTED]
Hello all, I have two integers and I want to divide one by another, and want to get an integer result which is the higher side whenever the result is a fraction. 3/2 => 1 # Usual behavior some_func(3, 2) => 2 # Wanted Any easier solution other than int(math.ceil(float(3)/2)) - Suresh -- http

Re: ftplib error- Large file

2007-06-07 Thread half . italian
On Jun 6, 11:21 pm, "Hendrik van Rooyen" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote: > > Hi all, > > > I'm using ftplib to transfer large files to remote sites. The process > > seems to work perfectly with small files, but when the file gets to > > large ~20GB I begin getting errors t

Verify server certificate in HTTPS transaction

2007-06-07 Thread Hamish Moffatt
Hi, I'm fetching some files over HTTPS from Python and I want to verify the server certificate. (Not just the name etc provided in certificate.) How can I get access to this information? urllib2 doesn't seem to provide it. Even a raw SSL socket only appears to provide access to the CN, OU etc i

Re: Integer division

2007-06-07 Thread Hamish Moffatt
[EMAIL PROTECTED] wrote: > Hello all, > I have two integers and I want to divide one by another, and want to > get an integer result which is the higher side whenever the result is > a fraction. > 3/2 => 1 # Usual behavior > some_func(3, 2) => 2 # Wanted > > Any easier solution other than int(m

Re: Help a C++ escapee!

2007-06-07 Thread Ant
Hi Simon, > When run, I come unstuck here: > > self.clientSocket, self.clientAddress = network.accept() > > I get a nameError on 'network', yet it is one in the global namespace, > defined in server.py before CServerThread.Listen() is called. You have imported everything from socketMa

Re: Help a C++ escapee!

2007-06-07 Thread Paul Melis
Hello, Simon Pickles wrote: > Can someone help me leave the murky c++ world and enter shiny pythonland? Welcome! > I have a problem with importing and global variables, here's my code: > > [...] > > When run, I come unstuck here: > >self.clientSocket, self.clientAddress = network.

Re: Help a C++ escapee!

2007-06-07 Thread Bjoern Schliessmann
Simon Pickles wrote: > from socket import * Bad idea, can make conflicts in namespace. > import threading There's absolutely no need to use threads for a server that accepts multiple connections :) > class CNetworkManager(): Note that you create an "old style" class. For new style classes, i

Re: Integer division

2007-06-07 Thread [EMAIL PROTECTED]
On Jun 7, 2:15 pm, Hamish Moffatt <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Hello all, > > I have two integers and I want to divide one by another, and want to > > get an integer result which is the higher side whenever the result is > > a fraction. > > 3/2 => 1 # Usual behavior >

Re: Tkinter, tkMessagebox and overrideredirect

2007-06-07 Thread Eric Brunel
On Thu, 07 Jun 2007 09:04:24 +0200, <[EMAIL PROTECTED]> wrote: [snip] > I can't believe there isn't an easier way to make a kiosk application > without titlebar. That's not the problem: there *is* an easy way, and you found it: overrideredirect(1). But now you're trying to mix windows ignored by

Re: Determinant of Large Matrix

2007-06-07 Thread Bjoern Schliessmann
James Stroud wrote: > If I run it again on 10 (or 1000) the set is basically homogenous > but now of different values (terribly confusing): > > set([12048175104.1, 12048175104.15, 12048175104.46, > 12048175103.94, 12048175104.23, 12048175103.81, > 12048175103.98, 12048

Where can I suggest an enchantment for Python Zip lib?

2007-06-07 Thread durumdara
Hi! Where can I ask it? I want to ask that developers change the Python's Zip lib in the next versions. The Zip lib not have a callback procedure. When I zip something, I don't know, what is the actual position of the processing, and how many bytes remaining. It is simply rewriteable, but when

Re: “On Your Desktop”: the celebr ity posting editorial blog

2007-06-07 Thread James Stroud
Steve Holden wrote: > The first post comes from Ian Bicking: > > http://onyourdesktop.blogspot.com/ > "Linux was a remote possibility: just why is it so bad as a laptop OS?" I'm a diehard os x man myself, but I spent about 1.5 days setting up ubuntu feisty on an Acer Travel Mate TM2480-2779 ($4

Re: Beginning Python

2007-06-07 Thread janislaw
On Jun 5, 4:29 pm, abhiee <[EMAIL PROTECTED]> wrote: > Hello , I have just begun learning python...and I'm loving it...Just > wanted to ask you that how much time would it take me to learn python > completely and which languages should i learn alongwith python to be a > good professional programmer

Re: Determinant of Large Matrix

2007-06-07 Thread Mark Westwood
Hi James Mathematica says that the determinant of the integer version of this matrix is 2774532096, which is another vote for the answer you have. Mathematica says that the determinant of the 24-digit real version of your matrix is 2.774532096*10^9, which looks very similar to me. I'd go with Nu

get a list from a string

2007-06-07 Thread simon kagwe
Hi, I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How can I go about that? I know I can use setattr, but how do I create the list from the string? Regards, Simon -- http://mail.python.org/mailman/

Re: get a list from a string

2007-06-07 Thread half . italian
On Jun 7, 3:34 am, simon kagwe <[EMAIL PROTECTED]> wrote: > Hi, > > I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a > variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How > can > I go about that? I know I can use setattr, but how do I create the list

Re: get a list from a string

2007-06-07 Thread simon kagwe
> exec("distances = [[1,1,1,1],[2,2,2,2]]") Wow! So simple! Thanks a lot. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, tkMessagebox and overrideredirect

2007-06-07 Thread marcoberi
On Jun 7, 12:01 pm, "Eric Brunel" <[EMAIL PROTECTED]> wrote: > BTW, what are you trying to do here? Will your application run on a > "normal" desktop computer? Or will it run on special devices such as > vending machines or similar? You got it: it's a special device. > in the second case, you sho

Why can not catch the inner exception

2007-06-07 Thread 人言落日是天涯,望极天涯不见家
Please see the follow code, I can not catch the exception " IOError" raised from shutil.copyfile() , why? try: if (DEST_TYPE & TYPE_FTP): fn = oname ftpc.UploadFile(f, fn) else:

Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread dmitrey
On Jun 7, 10:18 am, Gerard Flanagan <[EMAIL PROTECTED]> wrote: > On Jun 7, 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: Thank you. And what is the simplest way (without split/join, if exist) to obtain name of directory parent to directory my_directory_name? Thx, D. > > > Hi all, > > I guess this q

recursion error using setattr and getattr

2007-06-07 Thread Nathan Harmston
Hi, I m trying to implement an object which contains lazy" variables. My idea is to alter the getattr and the setattr methods. However I keep on getting a recursion error. My idea is that the lazy variable can be stored in a variety of places, Database, PyTables etc. The lazy variable is a large

Re: Integer division

2007-06-07 Thread Sion Arrowsmith
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > 3/2 => 1 # Usual behavior > some_func(3, 2) => 2 # Wanted def some_func(a, b): return -(-a/b) And people complain about Python's behaviour regarding division of negative integers. -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/

Re: recursion error using setattr and getattr

2007-06-07 Thread Simon Brunning
On 6/7/07, Nathan Harmston <[EMAIL PROTECTED]> wrote: > Hi, > > I m trying to implement an object which contains lazy" variables. My > idea is to alter the getattr and the setattr methods. However I keep > on getting a recursion error. Simplifying radically, you are doing: def __setattr__(sel

Re: get a list from a string

2007-06-07 Thread Dustan
On Jun 7, 6:06 am, simon kagwe <[EMAIL PROTECTED]> wrote: > > exec("distances = [[1,1,1,1],[2,2,2,2]]") To be clear, exec is *not* a function; it's a statement. That means it can't be used in lambda functions, for example. > Wow! So simple! but dodgy, as it'll execute any python code. > Thanks

Re: get a list from a string

2007-06-07 Thread Josef Dalcolmo
simon kagwe wrote: > Hi, > > I have a string "distances = [[1,1,1,1],[2,2,2,2]]". I want to create a > variable called distances whose value is the list [[1,1,1,1],[2,2,2,2]]. How > can > I go about that? s = "distances = [[1,1,1,1],[2,2,2,2]]" exec(s) - Josef -- http://mail.python.org/mailm

How to wrap a Japanese text in Python

2007-06-07 Thread prashantkisanpatil
Hi All, I am trying to wrap a japanese text in Python, by the following code. if len(message) > 54: message = message.decode("UTF8") strlist = textwrap.wrap(message,54) After this I am wirting it to you a CAD Software window. While displaying in this window some Japanese characters at the

RE: creating lists based on parsed items

2007-06-07 Thread Jason White
Sorry ... one minor detail lacking. I'm saddled with Python 2.3.4 Jason -Original Message- From: [EMAIL PROTECTED] on behalf of Basilisk96 Sent: Wed 6/6/2007 6:49 PM To: python-list@python.org Subject: Re: creating lists based on parsed items > If you are using Python 2.5, use a defaul

Re: howto obtain directory where current (running) py-file is placed?

2007-06-07 Thread Gerard Flanagan
On Jun 7, 1:19 pm, dmitrey <[EMAIL PROTECTED]> wrote: > On Jun 7, 10:18 am, Gerard Flanagan <[EMAIL PROTECTED]> wrote:> On Jun 7, > 8:39 am, dmitrey <[EMAIL PROTECTED]> wrote: > > Thank you. > And what is the simplest way (without split/join, if exist) to obtain > name of directory parent to direc

Re: "On Your Desktop": the celebrity posting editorial blog

2007-06-07 Thread Paul Boddie
On 7 Jun, 12:09, James Stroud <[EMAIL PROTECTED]> wrote: > Steve Holden wrote: > > The first post comes from Ian Bicking: > > >http://onyourdesktop.blogspot.com/ > > "Linux was a remote possibility: just why is it so bad as a laptop OS?" There are no mysteries about Linux vs. laptop hardware, alth

Re: get a list from a string

2007-06-07 Thread Steven D'Aprano
On Thu, 07 Jun 2007 11:06:54 +, simon kagwe wrote: >> exec("distances = [[1,1,1,1],[2,2,2,2]]") > Wow! So simple! > > Thanks a lot. :-) Yes, and when you embed this in your web-application, using data gathered from a web-form, the black-hat hackers will thank you for the security hole too.

Help with PAM and ctypes

2007-06-07 Thread Chris AtLee
Sorry for the repeat post...I'm not sure if my first post (on May 30th) went through or not. I've been trying to write a PAM module using ctypes. In the conversation function (my_conv in the script below), you're passed in a pam_response** pointer. You're supposed to allocate an array of pam_res

Re: get a list from a string

2007-06-07 Thread Steven D'Aprano
Ah, sorry, pre-mature sending. Stupid keyboard accelerators :( To finish the sentence I was trying to write: On Thu, 07 Jun 2007 22:39:41 +1000, Steven D'Aprano wrote: > I wish even more that Python would come with a built-in "make a list from a > list representation" function, but that at least

Bragging about Python

2007-06-07 Thread [EMAIL PROTECTED]
Is there a resource somewhere on the net that can be used to quickly and effectively show Python's strengths to non-Python programmers? Small examples that will make them go "Wow, that _is_ neat"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Bragging about Python

2007-06-07 Thread Steve Howell
--- "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Is there a resource somewhere on the net that can be > used to quickly > and effectively show Python's strengths to > non-Python programmers? > Small examples that will make them go "Wow, that > _is_ neat"? > 15 small programs here: http://w

Unable to start IDLE

2007-06-07 Thread Kishore D
Hi, I am facing a problem in starting IDLE. The hourglass appears for a while and then goes off. When i tried opening it after switching of the firewall, it still din help. If some other program is accessing the port can anyone tell me how to assign the port to python. Thanks . -- http://mail

RE: creating lists based on parsed items

2007-06-07 Thread Jason White
Thanks ... Seems just like perl's list-in-a-hash (I've read some of the archives and no, I'm not seeking to incite a perl-vs-python flame war). I thought of doing this initially (and would have done via Perl), but didn't quite have a grip on associative arrays in python yet. Thanks for the input

subprocess call acts differently than command line call?

2007-06-07 Thread Jim
Hello, I need a program that will traverse a directory tree to ensure that there are unix-style line endings on every file in that tree that is a text file. To tell text files from others I want to use the unix "file" command (Python's "mimetypes" is not so good for me). But I am stuck on somethi

Baffled on Windows.

2007-06-07 Thread Neil Cerutti
I have the following Python program: import win32com.client print 'Huh?' # Actually, it says something profain. Running this program with 2.5.1 causes another Python script in the same directory to be loaded and run (specifically the import causes it), and a .pyc file is created from that list.

Re: Integer division

2007-06-07 Thread Hamish Moffatt
[EMAIL PROTECTED] wrote: > On Jun 7, 2:15 pm, Hamish Moffatt <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Hello all, >>> I have two integers and I want to divide one by another, and want to >>> get an integer result which is the higher side whenever the result is >>> a fraction. >>>

Re: Baffled on Windows.

2007-06-07 Thread Tim Golden
Neil Cerutti wrote: > I have the following Python program: > > import win32com.client > print 'Huh?' # Actually, it says something profain. > > > Running this program with 2.5.1 causes another Python script in > the same directory to be loaded and run (specifically the import > causes it), and a

FTPLIB fails to retreive the remote file

2007-06-07 Thread Hrusikesa Patro
Hi All, I'm trying to download a remote file through FTP. Here's the script: ### #!/usr/bin/env python import ftplib import os import time ddir="C:\\ftp" os.chdir(ddir) f=ftplib.FTP("10.2.2.1", "user", "user123") f.cwd("/home/protocol/c

Re: subprocess leaves child living

2007-06-07 Thread Thomas Dybdahl Ahle
Den Thu, 07 Jun 2007 07:00:53 + skrev reed: > On Jun 5, 7:58 am, Thomas Dybdahl Ahle <[EMAIL PROTECTED]> wrote: >> Hi, When I do a small program like >> >> from subprocess import Popen >> popen = Popen(["ping", "google.com"]) from time import sleep >> sleep(100) >> >> start it and kill it, the

Lack of += and -= operators in Pyrex?

2007-06-07 Thread Skip Montanaro
I'm experimenting a bit with Pyrex and like it pretty well so far. While converting a module from Python to Pyrex I noticed it complains about the use of the += and -= assignment operators. The fix is obviously pretty trivial. I didn't notice any mention in the Pyrex docs as a difference between

Tkinter custom drawing

2007-06-07 Thread Xavier Bérard
Hello everyone, I am wondering if there is a way to use custom drawing in Tkinter. I've been using it for few months, and all I know about custom drawing is to draw directly on a Canvas with such methods as "create_line", "create_rectangle", etc. Now, the problem, is that I have already plenty of

pickling problem

2007-06-07 Thread Brian Blais
Hello, I have a somewhat nested dict that I want to pickle, but it (sometimes) contains some no-no's (specifically, in this case, functions). I know I can't pickle them, but I would like to be able to pickle the rest of the dict. Is there a good way to be able to walk through a dict, and tak

Re: Bragging about Python

2007-06-07 Thread Mathias Panzenboeck
Steve Howell schrieb: > --- "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > >> Is there a resource somewhere on the net that can be >> used to quickly >> and effectively show Python's strengths to >> non-Python programmers? >> Small examples that will make them go "Wow, that >> _is_ neat"? >> >

url to image

2007-06-07 Thread sononix
just wondering are there any snippets out there where you can convert a url to an image using python I have be trying to use webbrowser.open("www.mypage.com") with printscreen but I have no means of finding out when the page url is fully loaded any tips tks M -- http://mail.python.org/mailma

open function fail after running a day

2007-06-07 Thread alexteo21
I have created a script using python that will batch process data files every hour The script is running on Solaris. Python version 2.3.3 t=open(filename,'rb') data=t.read() #processing data... t.close() The script is working fine on the day of execution. It is able to process the data files ver

Re: Why can not catch the inner exception

2007-06-07 Thread Mark T
"人言落日是天涯,望极天涯不见家" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Please see the follow code, I can not catch the exception " IOError" raised from shutil.copyfile() , why? try: if (DEST_TYPE & TYPE_FTP): fn = oname

Re: open function fail after running a day

2007-06-07 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, alexteo21 <[EMAIL PROTECTED]> wrote: > The script is working fine on the day of execution. > It is able to process the data files very hour. However, the > processing fail one day later i.e. the date increment by 1. > > Traceback (most recent call last): > File

RE: MySQL InterfaceError

2007-06-07 Thread Joe
> Huh the only thing I can find on InterfaceError is "Errors related to > the database interface and not the database itself." You might be able > to get some info from connection.info() . . . Yeah, I wish there was more documentation about this type of error. The only thing info() tells me is th

Re: Lack of += and -= operators in Pyrex?

2007-06-07 Thread Skip Montanaro
> ... I noticed it complains > about the use of the += and -= assignment operators. The fix is > obviously pretty trivial. I didn't notice any mention in the Pyrex > docs as a difference between Python and Pyrex though. Was I mistaken? Never mind. I missed the bit where it said they haven't ye

Re: Baffled on Windows.

2007-06-07 Thread BartlebyScrivener
On Jun 7, 8:17 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > I have the following Python program: > > Running this program with 2.5.1 causes another Python script in > the same directory to be loaded . . . 'new.py' A good habit for naming your scripts: If you have a script and you want to name it

Re: Integer division

2007-06-07 Thread Sion Arrowsmith
Hamish Moffatt <[EMAIL PROTECTED]> wrote: >[EMAIL PROTECTED] wrote: > def div_ceil(a, b): >> ... if a%b: >> ... return ((a/b)+1) >> ... else: >> ... return (a/b) > >Yes, although it's not as short or as fast (probably as my version): > >def div_ceil(a, b): > return

Re: ctypes: error passing a list of str to a fortran dll

2007-06-07 Thread luis
On 5 jun, 06:15, Charles Sanders <[EMAIL PROTECTED]> wrote: > luis wrote: > > I'm using ctypes to call afortrandllfrom python. I have no problems > > passing integer and double arryas, but I have an error with str arrys. > > For example: > > [snip] > > I do not know about MicrosoftFortrancompilers

Re: Baffled on Windows.

2007-06-07 Thread Robin Becker
BartlebyScrivener wrote: > On Jun 7, 8:17 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > A good habit for naming your scripts: If you have a script and you > want to name it text.py, or list.py or new.py or old.py or some common > name that might be found in the thousand and one other modul

Re: Designing a graph study program

2007-06-07 Thread andrea
On 10 Mag, 16:52, Alexander Schliep <[EMAIL PROTECTED]> wrote: > andrea <[EMAIL PROTECTED]> writes: > > On 9 Mag, 09:10, Alexander Schliep <[EMAIL PROTECTED]> wrote: > >> Check outhttp://gato.sf.net(LGPLlicense). It does exactly what you > >> want to do and there is a binary for MacOS X. Algorithms

Re: Tkinter custom drawing

2007-06-07 Thread Kevin Walzer
Xavier Bérard wrote: > > Now, the problem, is that I have already plenty of widgets on my > screen. I just want to draw over them, which is a bit difficult in my > comprehension of things. > What are you trying to achieve by "drawing over" widgets? -- Kevin Walzer Code by Kevin http://www.code

Re: ftplib error- Large file

2007-06-07 Thread Facundo Batista
[EMAIL PROTECTED] wrote: > Why would storbinary throw an exception even when the file transfer > was successful? Why would the exception not be thrown until after the > file was sent? Shouldn't ftplib return something like (104, > "Connection reset by peer") instead of throwing an error? Is my

Re: Help a C++ escapee!

2007-06-07 Thread Jason
On Jun 7, 1:59 am, "Simon Pickles" <[EMAIL PROTECTED]> wrote: > Hi, > > Can someone help me leave the murky c++ world and enter shiny pythonland? > > I have a problem with importing and global variables, here's my code: [snip!] > When run, I come unstuck here: > > self.clientSocket, sel

Re: Why can not catch the inner exception

2007-06-07 Thread kelvin.you
On 6 7 , 10 53 , "Mark T" <[EMAIL PROTECTED]> wrote: > " " <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > > > > Please see the follow code, I can not catch the exception " IOError" > > raised from shutil.copyfile() , why? > >try: > >

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

2007-06-07 Thread dmoore
Hi folks, I've seen the following issue come up in multiple posts to this mailing list: I have a python program that spawns a child process with popen or popen2 or popen3 or popen2.popen2 etc. the child process is interactive: it asks for input then spits out some output, asks for more input then

running a random function

2007-06-07 Thread David Bear
I would like to write some code that would randomly select a function from a list of functions and call it. I was looking in the globals names space and randomly selecting items that were of type function.. but I didn't see a way of actually running the function. Any pointers? -- David Bear -- l

Re: MySQL InterfaceError

2007-06-07 Thread kaens
On 6/7/07, Joe <[EMAIL PROTECTED]> wrote: > > Huh the only thing I can find on InterfaceError is "Errors related to > > the database interface and not the database itself." You might be able > > to get some info from connection.info() . . . > > Yeah, I wish there was more documentation about this t

updating db with csv

2007-06-07 Thread moishyyehuda
#1 If any one familiar with godaddy hosting. They have apparently have a hosing server i.e.(scripts, html files etc.), and a server for databases. How can I import from my script, with a csv. if the db is on a different server than the script server. #2 I would like to update and insert with the

Re: running a random function

2007-06-07 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, David Bear wrote: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of actually runnin

Re: running a random function

2007-06-07 Thread Matimus
How are you making the list of functions? Something like this: [code] fs = [] for k,f in globals(): if callable(f): fs.append(f) [/code] Then to call a random one (assuming they all take no parameters): [code] import random random.choice(fs)() [/code] Or maybe you only have the name

Re: running a random function

2007-06-07 Thread Brian van den Broek
David Bear said unto the world upon 06/07/2007 11:56 AM: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of a

Re: Baffled on Windows.

2007-06-07 Thread Neil Cerutti
On 2007-06-07, Robin Becker <[EMAIL PROTECTED]> wrote: > BartlebyScrivener wrote: >> On Jun 7, 8:17 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >> A good habit for naming your scripts: If you have a script and you >> want to name it text.py, or list.py or new.py or old.py or some common

Re: running a random function

2007-06-07 Thread Dustan
On Jun 7, 10:56 am, David Bear <[EMAIL PROTECTED]> wrote: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. Careful!!! You don't want t

easiest way to count memory eaten by call to Python func?

2007-06-07 Thread dmitrey
hi all, which way is the simplest for now to obtain the memory amount eaten by call to Python 'myfunc' function? Thx, D -- http://mail.python.org/mailman/listinfo/python-list

Re: open function fail after running a day

2007-06-07 Thread Vinay Sajip
On Jun 7, 3:33 pm, alexteo21 <[EMAIL PROTECTED]> wrote: > I have created a script using python that will batch process data > files every hour > The script is running on Solaris. Python version 2.3.3 > > t=open(filename,'rb') > data=t.read() > #processing data... > t.close() Try the following app

Re: running a random function

2007-06-07 Thread Roberto Bonvallet
On 7 jun, 11:56, David Bear <[EMAIL PROTECTED]> wrote: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of act

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

2007-06-07 Thread Nick Craig-Wood
dmoore <[EMAIL PROTECTED]> wrote: > I've seen the following issue come up in multiple posts to this > mailing list: > > I have a python program that spawns a child process with popen or > popen2 or popen3 or popen2.popen2 etc. > the child process is interactive: it asks for input then spits o

Re: running a random function

2007-06-07 Thread Stebanoid
On 7, 19:56, David Bear <[EMAIL PROTECTED]> wrote: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of act

pyExcelerator Protection insert_bitmap

2007-06-07 Thread pythonwin pythonwin
Good evening! say, please, as in *.xls to insert an unscreened picture? example: image.py but a picture in OpenOficce is not represented :( OS - windows XP, debian etch pyExcelerator 0.6.3a-1 #!/usr/bin/env python # -*- coding: windows-1251 -*- # Copyright (C) 2005 Kiseliov Roman __rev_id__ =

Re: MySQL InterfaceError

2007-06-07 Thread BartlebyScrivener
On Jun 7, 10:09 am, "Joe" <[EMAIL PROTECTED]> wrote: > > And, yes, printing the error message returns absolutely nothing. The tuple > following InterfaceError is both the error code and message. Unfortunately, > it will only give me (0, '') which isn't much help. > I'm on Google groups and can't

Re: running a random function

2007-06-07 Thread Stebanoid
On 7, 19:56, David Bear <[EMAIL PROTECTED]> wrote: > I would like to write some code that would randomly select a function from a > list of functions and call it. I was looking in the globals names space and > randomly selecting items that were of type function.. but I didn't see a > way of act

Re: Python for embedded systems with memory constraints

2007-06-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, vishnu <[EMAIL PROTECTED]> wrote: >Hi there, > >I am embedding python 2.5 on embedded system running on RTOS where I >had strict memory constraints. >As python is a huge malloc intensive application, I observed huge >memory fragmentation in my system which is leadin

Re: Who uses Python?

2007-06-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > >"Stef Mientki" <[EMAIL PROTECTED]> wrote: > >> I use Python as a replacement for MatLab, >> and intend to use it as replacement for Delphi, AutoIt, PHP, VB. >> And I'ld love to use it as a replacement for micro contro

Re: lists - append - unique and sorted

2007-06-07 Thread Terry Reedy
"Dan Bishop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | If you don't need the list to be sorted until you're done building it, | you can just use: | | lst = sorted(set(lst)) ?? looks same as lst.sort() -- http://mail.python.org/mailman/listinfo/python-list

Re: Integer division

2007-06-07 Thread Terry Reedy
"Sion Arrowsmith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: | > 3/2 => 1 # Usual behavior | > some_func(3, 2) => 2 # Wanted | | def some_func(a, b): |return -(-a/b) | | And people complain about Python's behaviour regarding divi

Re: TLSAbruptCloseError

2007-06-07 Thread Gabriel Genellina
En Tue, 05 Jun 2007 14:22:48 -0300, Todd Hopfinger <[EMAIL PROTECTED]> escribió: > I am using TLS Lite and J2ME SecureConnection for the purposes of > encrypting > traffic to/from a Java Midlet client and a multithreaded Python server. > However, I encounter a TLSAbruptCloseError. I have tried

Re: open function fail after running a day

2007-06-07 Thread Vinay Sajip
Try the following: import logging t=open(filename,'rb') try: data=t.read() #processing data... except: logging.exception("Failed to process %r", filename) finally: t.close() -- http://mail.python.org/mailman/listinfo/python-list

Re: Where can I suggest an enchantment for Python Zip lib?

2007-06-07 Thread Terry Reedy
"durumdara" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hi! | | Where can I ask it? | | I want to ask that developers change the Python's Zip lib in the next | versions. On the sourceforge tracker, http://sourceforge.net/tracker/?group_id=5470 there is a Feature Request cate

Re: Where can I suggest an enchantment for Python Zip lib?

2007-06-07 Thread Larry Bates
durumdara wrote: > Hi! > > Where can I ask it? > > I want to ask that developers change the Python's Zip lib in the next > versions. > The Zip lib not have a callback procedure. When I zip something, I don't > know, what is the actual position of the processing, and how many bytes > remaining. >

Re: open function fail after running a day

2007-06-07 Thread Vinay Sajip
Try the following (Python 2.5.x): import logging t=open(filename,'rb') try: data=t.read() #processing data... except: logging.exception("Failed to process %r", filename) finally: t.close() For earlier versions of Python, you will need to nest the try blocks: import logging t=op

Re: subprocess call acts differently than command line call?

2007-06-07 Thread Rob Wolfe
Jim <[EMAIL PROTECTED]> writes: > Hello, > > I need a program that will traverse a directory tree to ensure that > there > are unix-style line endings on every file in that tree that is a text > file. > To tell text files from others I want to use the unix "file" command > (Python's "mimetypes" is

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

2007-06-07 Thread Terry Reedy
"dmoore" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | alternatives in the standard python distro) Is there some place I can | submit this as a feature request? (Python dev?) http://sourceforge.net/tracker/?group_id=5470 But don't hold your breath for a volunteer to respond. Di

Re: running a random function

2007-06-07 Thread Neil Cerutti
On 2007-06-07, Stebanoid <[EMAIL PROTECTED]> wrote: > if you have a list of functions you can try this: > > import random > import math > m[int(math.floor(len(m)*random.random()))]() # seems like Lisp Or rather m[random.randint(0, len(m))]() -- Neil Cerutti Caution: Cape does not enable user to

  1   2   >