Re: Integer division

2007-06-07 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Dan Bishop wrote: > On Jun 7, 8:30 pm, Some Other Guy <[EMAIL PROTECTED]> wrote: >> Since this just involves doubling you can avoid multiplying altogether >> and just use this: >> >> def rounddiv(a,b): >> return int((a+a+b)/(b+b)) >> >> That's 3 integer adds and 1 integer

Re: Bragging about Python

2007-06-07 Thread Szabolcs Nagy
Steve Howell wrote: > --- Georg Brandl <[EMAIL PROTECTED]> wrote: > > >> > > >> 15 small programs here: > > >> > > >> http://wiki.python.org/moin/SimplePrograms > > >> > > > > > > IMHO a few python goodies are missing there. > > > > "It's a Wiki." ;) > > > > Yes indeed. Please feel free to add to

Re: read xml file from compressed file using gzip

2007-06-07 Thread Stefan Behnel
flebber wrote: > I was working at creating a simple program that would read the content > of a playlist file( in this case *.k3b") and write it out . the > compressed "*.k3b" file has two file and the one I was trying to read > was maindata.xml. Consider using lxml. It reads in gzip compressed XML

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread Josiah Carlson
Some Other Guy wrote: > vdicarlo wrote: >> I am a programming amateur and a Python newbie who needs to convert >> about 100,000,000 strings of the form "1999-12-30" into ordinal dates >> for sorting, comparison, and calculations. Though my script does a ton >> of heavy calculational lifting (for wh

Re: Integer division

2007-06-07 Thread Terry Reedy
"Some Other Guy" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | [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 =>

read xml file from compressed file using gzip

2007-06-07 Thread flebber
I was working at creating a simple program that would read the content of a playlist file( in this case *.k3b") and write it out . the compressed "*.k3b" file has two file and the one I was trying to read was maindata.xml . I cannot however seem to use the gzip module correctly. Have tried the prog

have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)

2007-06-07 Thread justpratik
hi please a have a look at my site http://justpratik.blogspot.com and there's link for contest so hurry before 15th june -- http://mail.python.org/mailman/listinfo/python-list

have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)have a look at my blog site for asp.net .. there is microsoft contest also ( u can win so much)

2007-06-07 Thread justpratik
hi please a have a look at my site http://justpratik.blogspot.com and there's link for contest so hurry before 15th june -- http://mail.python.org/mailman/listinfo/python-list

compiling python and calling it from C/C++

2007-06-07 Thread Russ
Is it possible to compile python code into a library (on unix), then link to it and call it from C/C++? If so, where can I learn how. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread Larry Bates
James T. Dennis wrote: > Some Other Guy <[EMAIL PROTECTED]> wrote: >> vdicarlo wrote: >>> I am a programming amateur and a Python newbie who needs to convert >>> about 100,000,000 strings of the form "1999-12-30" into ordinal dates >>> for sorting, comparison, and calculations. Though my script doe

Re: Integer division

2007-06-07 Thread Dan Bishop
On Jun 7, 8:30 pm, Some Other Guy <[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 >

mysqlimport error

2007-06-07 Thread moishyyehuda
whey when I execute this statment cursor.execute("""mysqlimport merchandise 1.txt""") I get this error ProgrammingError: (1064, "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqlimport merchandise 1.txt' at l

Re: How does os.walk work?

2007-06-07 Thread [EMAIL PROTECTED]
On Jun 7, 5:13 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > Simple: os.walk builds the list to contain all the subdirectories. > After giving you a chance to modify that list, ow.walk then goes through > the list (whatever contents it has at that point) and visits any > subdirectory. > > I'd guess

Re: How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread James T. Dennis
Some Other Guy <[EMAIL PROTECTED]> wrote: > vdicarlo wrote: >> I am a programming amateur and a Python newbie who needs to convert >> about 100,000,000 strings of the form "1999-12-30" into ordinal dates >> for sorting, comparison, and calculations. Though my script does a ton >> of heavy calculati

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

2007-06-07 Thread dmoore
thanks for all of your responses. i'll look more closely at pexpect (The version I originally saw was much much older). I do want a cross- platform solution. I'm pretty busy so getting the wxProcess magic into useful shape will take me some time (at least on the order of weeks) so other interest pa

How Can I Increase the Speed of a Large Number of Date Conversions

2007-06-07 Thread vdicarlo
I am a programming amateur and a Python newbie who needs to convert about 100,000,000 strings of the form "1999-12-30" into ordinal dates for sorting, comparison, and calculations. Though my script does a ton of heavy calculational lifting (for which numpy and psyco are a blessing) besides converti

Re: pickling problem

2007-06-07 Thread Pomato
Brian Blais wrote: > 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 a

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

2007-06-07 Thread Noah
On Jun 7, 9:01 am, dmoore <[EMAIL PROTECTED]> wrote: popen and friends will never do what you want it to do. Down that path lies bitter disappointment. You need pseduo-ttys and non-blocking IO. I don't know how to do this on Windows, but I know it's possible. Cygwin does it. > Anybody have any th

Re: Bragging about Python

2007-06-07 Thread Steve Howell
--- Georg Brandl <[EMAIL PROTECTED]> wrote: > >> > >> 15 small programs here: > >> > >> http://wiki.python.org/moin/SimplePrograms > >> > > > > IMHO a few python goodies are missing there. > > "It's a Wiki." ;) > Yes indeed. Please feel free to add to the page, or make your own fork. See l

Re: Running a process every N days

2007-06-07 Thread kaens
On 6/7/07, David Bear <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > > What's the best way to run either an entire python process or a python > > thread every N days. I'm running Python 2.4.3 on Fedora Core 5 Linux. > > My code consists of a test and measurement system that runs 24/7 in

RE: Python 2.5.1 - sqlite3.dll issue

2007-06-07 Thread Delaney, Timothy (Tim)
Delaney, Timothy (Tim) wrote: > Josh Ritter wrote: > >> A number of our Windows customers have an issue with the sqlite3 >> module included with Python 2.5.1 >> >> We've tracked the problem down to the sqlite3.dll included with the >> Python >> 2.5.1 distrubtion. It is stripped and thus cannot

Re: Bragging about Python

2007-06-07 Thread Steve Howell
Programs like this were posted on this thread: >def fib(): >generation, parent_rabbits, baby_rabbits = 1, > 1, 1 >while True: >yield generation, baby_rabbits >generation += 1 >parent_rabbits, baby_rabbits = \ > baby_rabbits,

Re: Running a process every N days

2007-06-07 Thread David Bear
[EMAIL PROTECTED] wrote: > What's the best way to run either an entire python process or a python > thread every N days. I'm running Python 2.4.3 on Fedora Core 5 Linux. > My code consists of a test and measurement system that runs 24/7 in a > factory setting. It collects alot of data and I'd like

Re: Bragging about Python

2007-06-07 Thread Steve Howell
--- Szabolcs Nagy <[EMAIL PROTECTED]> wrote: > > actually i don't like when a tutorial uses over > complicated cute names > if the context is obvious (fibonacci) then we don't > need to add > 'parent_rabbits' and such identifiers I still prefer the use of "rabbits," but I don't mind if people ch

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

2007-06-07 Thread Stef Mientki
Gerard Flanagan wrote: > 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__) here I get an error "__file_

Re: Running a process every N days

2007-06-07 Thread Diez B. Roggisch
[EMAIL PROTECTED] schrieb: > What's the best way to run either an entire python process or a python > thread every N days. I'm running Python 2.4.3 on Fedora Core 5 Linux. > My code consists of a test and measurement system that runs 24/7 in a > factory setting. It collects alot of data and I'd lik

Re: Running a process every N days

2007-06-07 Thread Klaas
On Jun 7, 3:27 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > What's the best way to run either an entire python process or a python > thread every N days. I'm running Python 2.4.3 on Fedora Core 5 Linux. > My code consists of a test and measurement system that runs 24/7 in a > factory settin

Re: Running a process every N days

2007-06-07 Thread Grant Edwards
On 2007-06-07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What's the best way to run either an entire python process or a python > thread every N days. man cron man 5 crontab -- Grant Edwards grante Yow! It don't mean a at

Re: Tkinter custom drawing

2007-06-07 Thread James Stroud
Xavier Bérard wrote: > 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 prob

Re: running a random function

2007-06-07 Thread Neil Cerutti
On 2007-06-07, Dustan <[EMAIL PROTECTED]> wrote: > On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> 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.r

Re: Bragging about Python

2007-06-07 Thread Szabolcs Nagy
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Mathias Panzenboeck <[EMAIL PROTECTED]> wrote: >def fib(): >generation, parent_rabbits, baby_rabbits = 1, 1, 1 >while True: >yield generation, baby_rabbits >generation += 1 >parent_rab

RE: Python 2.5.1 - sqlite3.dll issue

2007-06-07 Thread Delaney, Timothy (Tim)
Josh Ritter wrote: > A number of our Windows customers have an issue with the sqlite3 > module included with Python 2.5.1 > > We've tracked the problem down to the sqlite3.dll included with the > Python > 2.5.1 distrubtion. It is stripped and thus cannot be relocated. This > causes the followi

Running a process every N days

2007-06-07 Thread [EMAIL PROTECTED]
What's the best way to run either an entire python process or a python thread every N days. I'm running Python 2.4.3 on Fedora Core 5 Linux. My code consists of a test and measurement system that runs 24/7 in a factory setting. It collects alot of data and I'd like to remove all data older than 30

RE: lists - append - unique and sorted

2007-06-07 Thread Delaney, Timothy (Tim)
Terry Reedy wrote: > "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() You missed that the OP wants only unique

Re: url to image

2007-06-07 Thread sononix
On Jun 7, 7:49 pm, Szabolcs Nagy <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > just wondering are there any snippets out there where you can convert > > a url to an image using python > > you mean render a webpage as an image? > does not sound a simple task > maybe you can use oss web

EuroPython 2007: Early Registration Deadline and Draft Timetable

2007-06-07 Thread Paul Boddie
EuroPython is the European Python and Zope Conference, taking place this year in Vilnius, Lithuania from Monday 9th July to Wednesday 11th July. The last day of EuroPython's early registration period is upon us: reduced rates will only be available until the end of today, Friday 8th June; after th

Re: How does os.walk work?

2007-06-07 Thread Gary Herron
[EMAIL PROTECTED] wrote: > In the example from help(os.walk) it lists this: > > from os.path import join, getsize > for root, dirs, files in walk('python/Lib/email'): > print root, "consumes", > print sum([getsize(join(root, name)) for name in files]), > print "bytes

How does os.walk work?

2007-06-07 Thread [EMAIL PROTECTED]
In the example from help(os.walk) it lists this: from os.path import join, getsize for root, dirs, files in walk('python/Lib/email'): print root, "consumes", print sum([getsize(join(root, name)) for name in files]), print "bytes in", len(files), "non-directory files

Re: running a random function

2007-06-07 Thread Dustan
On Jun 7, 1:30 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > 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.ran

Re: subprocess call acts differently than command line call?

2007-06-07 Thread Jim
On Jun 7, 2:30 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote: > That's really strange. Have you got only *one* version of ``file`` > program on your machine? Thank you, Rob. I thought I had that kind of thing covered in specifying the -m but obviously there was something I wasn't getting, and you found

Python 2.5.1 - sqlite3.dll issue

2007-06-07 Thread Josh Ritter
A number of our Windows customers have an issue with the sqlite3 module included with Python 2.5.1 We've tracked the problem down to the sqlite3.dll included with the Python 2.5.1 distrubtion. It is stripped and thus cannot be relocated. This causes the following exception on computers where

Re: Bragging about Python

2007-06-07 Thread Georg Brandl
Mathias Panzenboeck schrieb: > 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

Re: Bragging about Python

2007-06-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Mathias Panzenboeck <[EMAIL PROTECTED]> wrote: >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-Pyt

Re: url to image

2007-06-07 Thread Szabolcs Nagy
[EMAIL PROTECTED] wrote: > just wondering are there any snippets out there where you can convert > a url to an image using python you mean render a webpage as an image? does not sound a simple task maybe you can use oss web rendering engines like gecco, khtml or webcore -- http://mail.python.or

Re: Who uses Python?

2007-06-07 Thread Stef Mientki
Hendrik van Rooyen 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 controller programming. > > If you have a little sub - 64

Re: recursion error using setattr and getattr

2007-06-07 Thread Gabriel Genellina
En Thu, 07 Jun 2007 08:23:48 -0300, Nathan Harmston <[EMAIL PROTECTED]> escribió: > 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. Instead of setattr/getattr, use a prope

Re: ftplib error- Large file

2007-06-07 Thread half . italian
On Jun 7, 8:54 am, Facundo Batista <[EMAIL PROTECTED]> wrote: > [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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

  1   2   >