Re: getting an object name

2005-06-22 Thread Irmen de Jong
David Bear wrote: > Let's say I have a list called, alist. If I pass alist to a function, > how can I get the name of it? > > alist = range(10) > > def afunction(list): > listName = list.__name__ (fails for a list object) > You don't, see the other reply. You didn't say why you think you n

Re: Loop until condition is true

2005-06-22 Thread Fredrik Lundh
Remi Villatel wrote: > >>while True: > >> some(code) > >> if final_condition is True: > >> break > >> # > >># > > > checking if a logical expression is true by comparing it to True is bad > > style, and comparing values using "is" is also bad style. > > Erm... You totally missed the point. I wrote

Re: getting an object name

2005-06-22 Thread Simon Brunning
On 6/22/05, David Bear <[EMAIL PROTECTED]> wrote: > Let's say I have a list called, alist. If I pass alist to a function, > how can I get the name of it? The effbot put it beautifully: "The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you i

Re: Using code objects?

2005-06-22 Thread Fredrik Lundh
Chinook wrote: > When I create the code objects though, it seems a couple different ways > work and I'm wondering which is better and why (or is there a more correct > technique in this situation)? from where are you getting the source code for those code objects? from the example below, it sure

Re: utf8 and ftplib

2005-06-22 Thread Fredrik Lundh
Fredrik Lundh wrote: > character references refer to code points in the Unicode code > space, so you just convert the bytes you get after converting > to UTF-8. "so you cannot just", of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: Dynamic Lists, or...?

2005-06-22 Thread TZOTZIOY
On 13 Jun 2005 01:04:53 -0700, rumours say that "Raymond Hettinger" <[EMAIL PROTECTED]> might have written: ># Professional driver on a closed course. ># Don't try this at home. > >data = """ >rose, 1, 500 >lilac, 1, 300 >lilly, 1, 400 >rose, 0, 100 >""" > >data = data.replace(', 1, ', ' += ') >da

C++ ActiveX python javascript communication trouble.

2005-06-22 Thread whimsica
I'm investingating a c++ api, Panda3d.com, that has a python binding. I want to convert this api into an ACtiveX control so it will run on the web. When I do so I want to use Microsoft Script Control to call api routines from Javascript in the browser. Let's say I write up a game in python with

C++ ActiveX python javascript communication trouble.

2005-06-22 Thread whimsica
I'm investingating a c++ api, Panda3d.com, that has a python binding. I want to convert this api into an ACtiveX control so it will run on the web. When I do so I want to use Microsoft Script Control to call api routines from Javascript in the browser. Let's say I write up a game in python with

Reading registry export files

2005-06-22 Thread George
Hi, I have exported some registry-keys using Regedit to a number of .reg-files. I can open these files using any text editor. Now I wanted to write a simple Python script to concatenate all these files to one output file. (Please note that I'm a newbie). However, if I do something like: >>>

Re: tree functions daily exercise: Table

2005-06-22 Thread Duncan Booth
Xah Lee wrote: > oops, another error. The example should be: > > Table(f,[1,2,1],[2,6,2]) returns > [[f(1,2),f(1,4),f(1,6)],[f(2,2),f(2,4),f(2,6)]] > >> Wouldn't it be more sensible just to take the iterators directly as >> arguments, so for this example you would do: >> >> Table(f, range(1,3),

RE: Reading registry export files

2005-06-22 Thread Tim Golden
[George] | Hi, | | I have exported some registry-keys using Regedit to a number of | .reg-files. I can open these files using any text editor. Now | I wanted | to write a simple Python script to concatenate all these files to one | output file. (Please note that I'm a newbie). | | However, if

Re: Running WMI within a Windows service

2005-06-22 Thread cameron . mccloud
Tim, Changing the path didn't do anything, but changing the name of the module to my_wmi did the trick. Thanks very much, Cam. Tim Golden wrote: > [EMAIL PROTECTED] > | Hi, > | > | When trying to import the WMI module in a Python Windows > | Service, I get > | the following: > | > | dynamic

Re: *Python* Power Tools

2005-06-22 Thread Daniel Dittmar
Micah wrote: > Anyone know if there is any organized effort underway to implement the > Python equivalent of "Perl Power Tools" ? > > If not, would starting this be a waste of effort since: > > - it's already being done in Perl? > - cygwin thrives? > - UNIX is already pervas

Re: tree functions daily exercise: Table

2005-06-22 Thread Duncan Booth
Duncan Booth wrote: > Ok, so, if I understand you, the definition of Table is just: > > def Table(f, *lists): > return Outer(f, > *[range(start,end+1,step) for (start,end,step) in lists]) > > Is that about right? > And lest you think I left a bit too much as an "exercise for the rea

RE: Running WMI within a Windows service

2005-06-22 Thread Tim Golden
[EMAIL PROTECTED] | [.. re problems running WMI in a service ...] | Changing the path didn't do anything, but changing the name of the | module to my_wmi did the trick. | | Thanks very much, | | Cam. | Thanks for the feedback; I'll try to find the time to experiment a bit but I know I've use

Re: Loop until condition is true

2005-06-22 Thread Ville Vainio
> "Stelios" == Stelios Xanthakis <[EMAIL PROTECTED]> writes: Stelios> Anyway, if you can't wait for 2.5 either use 'while 1:', Stelios> or pyc[1] ... and I can't see why people don't want to use 'while 1:' in the first place, given that everyone can identify the idiom immediately. It'

Re: Embedding Python - Deleting a class instance

2005-06-22 Thread Andreas Kostyrka
On Tue, Jun 21, 2005 at 12:06:47PM +, Bue Krogh Vedel-Larsen wrote: > How do I delete a class instance created using PyInstance_New? I've tried > calling Py_CLEAR on the instance, but __del__ isn't called. I've also tried > calling PyObject_Del, but this gives an access violation in > _PyObj

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Zunbeltz Izaola
On Tue, 21 Jun 2005 11:07:35 -0400, Peter Hansen wrote: > > Please clarify: what does this mean? "Sending a socket" is not a usual > way to describe TCP communications. Do you mean your program _opens_ a > socket (like a phone connection) and _sends_ some data, then waits for > data to be re

Re: *Python* Power Tools

2005-06-22 Thread Ville Vainio
> "John" == John Machin <[EMAIL PROTECTED]> writes: John> For windows users, apart from cygwin, there are a couple of John> sources of binaries for *x command-line utilities (unxutils, John> gnuwin32). unxutils is my personal favourite - cygwin is way too much an "environment", an

Re: need to strip stuff off email

2005-06-22 Thread Tim Williams
> "nephish" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > hey there, > > i have a script that retrieves my email, but i need it to > > be able to strip all the stuff off except the body (the message itself) > > so i can later write it to a text file. > > > > anyone know how to

suggestions invited

2005-06-22 Thread Aditi
hi all...i m a software engg. student completed my 2nd yr...i have been asked to make a project during these summer vacations...and hereby i would like to invite some ideas bout the design and implementation of an APPLICATION MONITORING SYSTEMi have to start from scrach so please tell me how to

Re: Want to learn a language - is Python right?

2005-06-22 Thread Aziz McTang
Hi Everyone, Thanks for all the helpful advice. Downloaded 2.4.1 and already have an inkling of some of the things it can do. Time to start learning! ATB Aziz -- http://mail.python.org/mailman/listinfo/python-list

Re: Loop until condition is true

2005-06-22 Thread Steven D'Aprano
On Wed, 22 Jun 2005 09:54:44 +0200, Fredrik Lundh wrote: >> [CENSORED] I keep for myself how stupid I found your post. > > so let's see if everyone who understands how embarrassingly stupid > your post is will keep that to themselves... Damn, did I fail some test? -- Steven. -- http://ma

Urgent: Embedding Python question please

2005-06-22 Thread adsheehan
Hi, I am embedding Python into a multi-threaded C++ application runnig on Solaris and need urgent clarification on the embedding architecture and its correct usage (as I am experience weird behaviors). Can anyone clarify: - if Python correctly supports multiple sub-interpreters (Py_NewInterprete

Re: Installing MySQL-Python

2005-06-22 Thread kai festersen
Cathy Hui wrote: > Do u know why do i get the following message error: command 'gcc' failed with exit status 1 yes: error: command 'gcc' failed with exit status 1 means: there's no compiler gcc ... kai when trying to build the > MySql-Python (1.2.0) on my Solaris 8 system? (with mysql 4.0.21

Re: need to strip stuff off email

2005-06-22 Thread Tim Williams
- Original Message - From: "Tim Williams" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 22, 2005 10:48 AM Subject: Re: need to strip stuff off email > > > > "nephish" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > hey there, > > > i have a script that retrieves my

importing a package

2005-06-22 Thread flupke
Hi, I developed a package with a structure like this src/ tesfile.py dir1/ __init__.py file1.py dir2/ __init__.py file2.py The testfile is meant to try the code out that is specified in file1.py and file2.py Now i have another project where i want to

Re: suggestions invited

2005-06-22 Thread Konstantin Veretennicov
On 22 Jun 2005 02:47:06 -0700, Aditi <[EMAIL PROTECTED]> wrote: > i have to make a system used by the IT department of a company which > contains 31 applications and their details which are being used in a > company ...the details are... > Application sub application catagorypla

Re: Getting/Saving email attachments w/ poplib and email modules

2005-06-22 Thread Tim Williams
- Original Message - From: <[EMAIL PROTECTED]> > > Here's what I'm trying to do: > > I need to connect to a pop3 server, download all messages, and copy all > of the attachments into a specific directory. The actual email message ## import email import poplib mimes = ["im

Re: Compiling C++ extensions with distutils on Cygwin

2005-06-22 Thread George Sakkis
"George Sakkis" wrote: > I'm trying to build a C++ extension on Cygwin, but it fails because > distutils invokes gcc instead of g++. Looking into distutils internals, > it turns out that compilation is assumed to be independent of the > target language, while linking is not (CCompiler.compile() do

Re: getting an object name

2005-06-22 Thread TZOTZIOY
On Wed, 22 Jun 2005 09:00:23 +0100, rumours say that Simon Brunning <[EMAIL PROTECTED]> might have written: >> Let's say I have a list called, alist. If I pass alist to a function, >> how can I get the name of it? > >The effbot put it beautifully: And IMO it should be in the FAQ: (http://www.pyth

Re: A World Beyond Capitalism 2005, An Annual International Multiracial Alliance Building Peace Conference Is Accepting Proposals...

2005-06-22 Thread Drazen Gemic
Take your political propaganda somewhere else. DG -- http://mail.python.org/mailman/listinfo/python-list

Re: python create WMI instances

2005-06-22 Thread future_retro
Create isn't a method of Win32_Printer so I couldn't get that to work. .Create is a method of Win32_Process which (wait for it..) creates a new process. Unfortunatly there is no method to add a printer. the method .AddPrinterConnection will allow me to add a connection to an existing print share

Re: A tool for Python - request for some advice

2005-06-22 Thread Mike Meyer
"TPJ" <[EMAIL PROTECTED]> writes: > I've written this script in bash, because I thought it would be better > to have a script which would run in environment without Python (it all > was about installing Python anyway!). I used bash, dialog, wget... And > now someone suggested, that I shuld use Pyt

Re: Getting/Saving email attachments w/ poplib and email modules

2005-06-22 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hello All, > > Here's what I'm trying to do: > > I need to connect to a pop3 server, download all messages, and copy all > of the attachments into a specific directory. The actual email message > is unimportant. Now, I've found plenty of examples that strip the > at

ANN: python-ldap-2.0.8

2005-06-22 Thread Michael Ströder
Find a new release of python-ldap: http://python-ldap.sourceforge.net/ python-ldap provides an object-oriented API to access LDAP directory servers from Python programs. It mainly wraps the OpenLDAP 2.x libs for that purpose. Additionally it contains modules for other LDAP-related stuff (e.g. p

Re: Loop until condition is true

2005-06-22 Thread Greg Lindstrom
A bit off topic, but what does the expression "Don't try to teach your grandfather how to suck eggs." mean? I've never heard it before and am curious to the story behind it. Thanks, --greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading registry export files

2005-06-22 Thread [EMAIL PROTECTED]
It works fine for me on NT. I think it has nothing to do with Python but with the way the file is created - what windows version are you on? Also note the possibility the '/' - I prefer a noatation like below to avoid ambiguity. Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]

Re: Reading registry export files

2005-06-22 Thread [EMAIL PROTECTED]
It works fine for me on NT. I think it has nothing to do with Python but with the way the file is created - what windows version are you on? Also note the possibility the '/' - I prefer a noatation like below to avoid ambiguity. Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)]

Re: Loop until condition is true

2005-06-22 Thread Tim Williams
- Original Message - From: "Greg Lindstrom" <[EMAIL PROTECTED]> > A bit off topic, but what does the expression "Don't try to teach your > grandfather how to suck eggs." mean? I've never heard it before and am > curious to the story behind it. A relatively well know phrase, however as

Re: A World Beyond Capitalism 2005, An Annual International Multiracial Alliance Building Peace Conference Is Accepting Proposals...

2005-06-22 Thread Peter Hansen
Jack Diederich wrote: > The '.info' domain also defeats > the linux 'whois' command to dig for registrar info. Maybe so, but it's always pretty easy to Google for "whois" plus the domain to find a way of doing it via the web, in this case with http://www.afilias.info/cgi-bin/whois.cgi . (It's r

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Peter Hansen
Zunbeltz Izaola wrote: > I opened the socket once (i don't know if > itit is important to open inside or outside the comunication thread). I don't believe it is important where it is opened, provided you don't try to do things with it from two threads at a time (without adequate protection). >

Re: importing a package

2005-06-22 Thread Damjan
> I developed a package with a structure like this > src/ > tesfile.py > dir1/ > __init__.py > file1.py > dir2/ > __init__.py > file2.py Importing dir2/file2 from dir1/file1.py works here, because when yuo started the testfile script the src/ directory w

Python API to manipulate CAB files.

2005-06-22 Thread Isaac Rodriguez
Does anyone know of a Python API to manipulate CAB files? Thanks, -- Isaac Rodriguez SWE Autodesk. There are 10 types of people. Those who undertand binary, and those who don't -- http://mail.python.org/mailman/listinfo/python-list

Re: Reading registry export files

2005-06-22 Thread Thorsten Kampe
* [EMAIL PROTECTED] (2005-06-22 13:59 +0100) > It works fine for me on NT. I think it has nothing to do with Python > but with the way the file is created - what windows version are you on? Windows uses UTF-16 since Windows 2000. Regedit offers the possibility to export in the old Win9x/NT4 format

Re: C++ ActiveX python javascript communication trouble.

2005-06-22 Thread BigBrian
> I'm investingating a c++ api, Panda3d.com, that has a python binding. > I want to convert this api into an ACtiveX control so it will run on > the web. When I do so I want to use Microsoft Script Control to call > api routines from Javascript in the browser. > > > Let's say I write up a game in

Re: sudoku dictionary attack

2005-06-22 Thread Nigel Greenwood
Nick Atty wrote: > On-line canal route planner: http://www.canalplan.org.uk So the Travelling Salesman goes by narrow boat these days, does he? Nigel -- ScriptMaster language resources (Chinese/Modern & Classical Greek/IPA/Persian/Russian/Turkish): http://www.elgin.free-online.co.uk -- http

Database recommendations for Windows app

2005-06-22 Thread Will McGugan
Hi, I'd like to write a windows app that accesses a locally stored database. There are a number of tables, the largest of which has 455,905 records. Can anyone recommend a database that runs on Windows, is fast / efficient and can be shipped without restrictions or extra downloads? I have goog

Re: getting an object name

2005-06-22 Thread Ron Adam
David Bear wrote: > Let's say I have a list called, alist. If I pass alist to a function, > how can I get the name of it? > > alist = range(10) > > def afunction(list): > listName = list.__name__ (fails for a list object) > Using an object's name as data isn't a good idea because it will g

[no subject]

2005-06-22 Thread Doug Ly
Is there a good IDE for Python? I have heard that Eclipse has a plugin for Jython only. Thanks   --Doug   -- http://mail.python.org/mailman/listinfo/python-list

Re: Need Python web hosting ASAP

2005-06-22 Thread MisterBuntMan
textdrive.com -- http://mail.python.org/mailman/listinfo/python-list

'custom' events ?

2005-06-22 Thread William Gill
I am trying to create a Python UI in Tkinter and have several (frame) widgets that display various data fields. I am trying to create a 'changed' event that each widget can trigger when they have been edited. I see lots of references that suggest that 'custom' events can be created, but have

Re: Loop until condition is true

2005-06-22 Thread Magnus Lycka
Remi Villatel wrote: > Erm... You totally missed the point. I wrote it this way because, first, > it's perfectly valid Python code and, second and most important, it's > also a valid english sentence. Remi, I think you have failed to understand what Fredrik was telling you. I can understand that

Re: asynchronous comunication, wxPython and threads.

2005-06-22 Thread Zunbeltz Izaola
On Wed, 22 Jun 2005 09:28:31 -0400, Peter Hansen wrote: > Almost certainly it is. It would be simplest to set up a worker thread > once, when the GUI thread begins, and simply send requests to it via a > Queue. It can create the socket, connect to the server, communicate, > close it down, an

Re: Database recommendations for Windows app

2005-06-22 Thread Thomas Bartkus
"Will McGugan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'd like to write a windows app that accesses a locally stored database. > There are a number of tables, the largest of which has 455,905 records. > > Can anyone recommend a database that runs on Windows, is fast /

a comprehensive Tkinter document?

2005-06-22 Thread William Gill
I know a major problem I am having is that I am finding lots of Tkinter information in 'fragments' of various , sometimes conflicting vintages. For example the python reference I was using didn't show the '%%' as an escape sequence, I posted asking how to escape the '%' and after several help

Re: importing a package

2005-06-22 Thread flupke
Damjan wrote: >>I developed a package with a structure like this >>src/ >>tesfile.py >>dir1/ >>__init__.py >>file1.py >>dir2/ >>__init__.py >>file2.py > > > Importing dir2/file2 from dir1/file1.py works here, because when yuo started > the testfile scri

Re: Database recommendations for Windows app

2005-06-22 Thread Gregory Piñero
I always figured a problem with using MySQL was distribution. Would you have to tell your users to install MySQL and then to leave the service running? I've never found an easy way to embed MySQL into a python app, and even if you could, would you then have to pay for it? -Greg On 6/22/05, Tho

Re: python create WMI instances

2005-06-22 Thread future_retro
Win32_Printer doesn't work with the Create method and AddPrinterConnection only lets me add a connection to a share. I'll try and work out how to set the printer object properties in the format suggested; oPrinter.Properties_ ("DriverName").Value = strDriver Cheers, MW. -- http://mail.python.

RE: python create WMI instances

2005-06-22 Thread Tim Golden
[EMAIL PROTECTED] | Win32_Printer doesn't work with the Create method and | AddPrinterConnection only lets me add a connection to a share. I'll | try and work out how to set the printer object properties in | the format | suggested; | | oPrinter.Properties_ ("DriverName").Value = strDriver | |

Re: Database recommendations for Windows app

2005-06-22 Thread Dan
Take a look at Firebird. It can be run in embedded mode. It might be overkill for your needs though... On 6/22/2005 10:37 AM, Gregory Piñero wrote: > I always figured a problem with using MySQL was distribution. Would > you have to tell your users to install MySQL and then to leave the > servi

Re: a comprehensive Tkinter document?

2005-06-22 Thread Kent Johnson
William Gill wrote: > I know a major problem I am having is that I am finding lots of Tkinter > information in 'fragments' of various , sometimes conflicting vintages. > For example the python reference I was using didn't show the '%%' as an > escape sequence, I posted asking how to escape the

Re: Database recommendations for Windows app

2005-06-22 Thread Dave Cook
On 2005-06-22, Will McGugan <[EMAIL PROTECTED]> wrote: > I'd like to write a windows app that accesses a locally stored database. > There are a number of tables, the largest of which has 455,905 records. > > Can anyone recommend a database that runs on Windows, is fast / > efficient and can be s

PEP ? os.listdir enhancement

2005-06-22 Thread Riccardo Galli
Hi, I noticed that when I use os.listdir I need to work with absolute paths 90% of times. While I can use a for cycle, I'd prefere to use a list comprehension, but it becomes too long. I propose to add an 'abs' keyword which would make os.listdir return the absolute path of files instead of a rel

Re: Loop until condition is true

2005-06-22 Thread Michael Hoffman
Remi Villatel wrote: > Fredrik Lundh wrote: >> checking if a logical expression is true by comparing it to True is bad >> style, and comparing values using "is" is also bad style. > > I wrote it this way because, first, it's perfectly valid Python code and, > second and most important, it's also

Looking for a web-based messaging system

2005-06-22 Thread Mike Meyer
One of my clients has a need for a web-based messaging system. Something python-based is preferred, as that's where our expertise is, but web frameworks built in Python are perfectly acceptable. If you know of something really good that isn't in Python, I wouldn't mind hearing about it - but I do h

Re: Database recommendations for Windows app

2005-06-22 Thread Magnus Lycka
Will McGugan wrote: > Hi, > > I'd like to write a windows app that accesses a locally stored database. > There are a number of tables, the largest of which has 455,905 records. > > Can anyone recommend a database that runs on Windows, is fast / > efficient and can be shipped without restriction

Re: Database recommendations for Windows app

2005-06-22 Thread Magnus Lycka
Thomas Bartkus wrote: > If you are writing strictly for the MS Windows platform >And > If the database is running single user with a "locally stored database" on a > Windows workstation. >Then > The MS Access file based (.mdb) system is hard to argue with. I disagree. What does .mdb/jet wi

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
Grant Edwards wrote: > I finally figured out why one of my apps sometimes fails under > Win32 when it always works fine under Linux: Under Win32, the > pickle module only works with a subset of floating point > values. In particular the if you try to dump/load an infinity > or nan value, the load

Dr. Dobb's Python-URL! - weekly Python news and links (Jun 22)

2005-06-22 Thread Simon Brunning
QOTW: "Python is more concerned with making it easy to write good programs than difficult to write bad ones." - Steve Holden "Scientists build so that they can learn. Programmers and engineers learn so that they can build." - Magnus Lycka "It happens that old Java programmers make one module per

Dr. Dobb's Python-URL! - weekly Python news and links (Jun 22)

2005-06-22 Thread Simon Brunning
QOTW: "Python is more concerned with making it easy to write good programs than difficult to write bad ones." - Steve Holden "Scientists build so that they can learn. Programmers and engineers learn so that they can build." - Magnus Lycka "It happens that old Java programmers make one module per

Re: Python API to manipulate CAB files.

2005-06-22 Thread Peter Maas
Isaac Rodriguez schrieb: > Does anyone know of a Python API to manipulate CAB files? If there is a Windows API you can probybly call it from Python using Mark Hammond's Win32 extensions. -- --- Peter Maas, M+R Infosysteme, D-52070

Re: PEP ? os.listdir enhancement

2005-06-22 Thread Jeff Epler
Why not just define the function yourself? Not every 3-line function needs to be built in. def listdir_joined(path): return [os.path.join(path, entry) for entry in os.listdir(path)] dirs = [x for x in listdir_joined(path) if os.path.isdir(x)] path_size = [(x, getsize(x)) for x in listdir_jo

Re: a comprehensive Tkinter document?

2005-06-22 Thread William Gill
Kent Johnson wrote: > William Gill wrote: > >> I know a major problem I am having is that I am finding lots of >> Tkinter information in 'fragments' of various , sometimes conflicting >> vintages. For example the python reference I was using didn't show >> the '%%' as an escape sequence, I pos

Re: Database recommendations for Windows app

2005-06-22 Thread Thomas Bartkus
Will McGugan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'd like to write a windows app that accesses a locally stored database. > There are a number of tables, the largest of which has 455,905 records. > > Can anyone recommend a database that runs on Windows, is fast /

Re: Loop until condition is true

2005-06-22 Thread Jeff Epler
def until(pred): yield None while True: if pred(): break yield None def example(): i = 0 for _ in until(lambda: x==0): x = 10 - i i += 1 print x, i example() pgpeP7iW6mcQm.pgp Description: PGP signature -- http://mail.python.org/mailman/l

Re: Database recommendations for Windows app

2005-06-22 Thread Dan
On 6/22/2005 11:38 AM, Thomas Bartkus wrote: > Will McGugan" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Hi, >> >>I'd like to write a windows app that accesses a locally stored database. >>There are a number of tables, the largest of which has 455,905 records. >> >>Can anyone

Re: PEP ? os.listdir enhancement

2005-06-22 Thread Peter Hansen
Riccardo Galli wrote: > I noticed that when I use os.listdir I need to work with absolute paths > 90% of times. > While I can use a for cycle, I'd prefere to use a list comprehension, > but it becomes too long. > > ### e.g. 1 part 1 - getting a list of directories ### > dirs=[] > for i in os.lis

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Grant Edwards
On 2005-06-22, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> I finally figured out why one of my apps sometimes fails under >> Win32 when it always works fine under Linux: Under Win32, the >> pickle module only works with a subset of floating point >> values. In particular the if you try to d

how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread scott
hi people, can someone tell me, how to use a class like that* (or "simulate" more than 1 constructor) : #-- class myPointClass: def __init__(self, x=0, y=0): self.x = x self.y = y def __init__(self, x=0, y=0, z=0): self.__init__(self, x, y) self.z = z #-- tia people sco

RE: Database recommendations for Windows app

2005-06-22 Thread Hughes, Chad O
Firebird is cross platform (you would need the classic server version) look at the following post: http://mail.python.org/pipermail/python-list/2005-June/286366.html Chad -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Will McGugan Sent: Wednesday, June

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread Steve
Hi Scott, > can someone tell me, how to use a class like that* (or "simulate" more > than 1 constructor) : One approach could be: class myPointClass: def __init__(self, **args): for k, v in args.items(): setattr(self, k, v) > *this is not homework Just to be safe, I'll le

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread Michael Hoffman
scott wrote: > can someone tell me, how to use a class like that* (or "simulate" more > than 1 constructor) : > #-- > class myPointClass: > def __init__(self, x=0, y=0): > self.x = x > self.y = y > def __init__(self, x=0, y=0, z=0): > self.__init__(self, x, y) > self.z = z > #

Re: Database recommendations for Windows app

2005-06-22 Thread Thomas Bartkus
"Dan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/22/2005 11:38 AM, Thomas Bartkus wrote: > > Will McGugan" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > > > And then XP Autoupdate executes, some of those Access/MSDE libraries are > updated, and you app

Re: PEP ? os.listdir enhancement

2005-06-22 Thread Michael Hoffman
Peter Hansen wrote: > Using Jason Orendorff's "path" module, all this code basically collapses > down to this beauty (with your variable "path" renamed to myPath to > avoid a name collision): This has to be the non-stdlib library I use the most. It's a great module. -- Michael Hoffman -- http

Re: JEP and JPype in a single process

2005-06-22 Thread Steve Menard
Steve Menard wrote: > skn wrote: > >> Hello, >> >> I have written a very simple java class file, which invokes a Python >> script >> using JEP. >> >> Code snippet:- >> --- >> Jep jep = new Jep(false); >> jep.runScript("C:\\temp\\testscript.py"); >> jep.close(); >> >> Now inside th

MySQLdb reconnect

2005-06-22 Thread Damjan
Does MySQLdb automatically reconnect if the connection to the database is broken? I'm asking this since I have a longrunning Python precess that is connected to Mysql-4.1.11, and I execute "set names utf8" when I connect to it. But after running a day the results from the python program were disp

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread Paul McGuire
This recipe that I submitted to the Python Cookbook (http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/223611) describes a technique for doing this. I use the example of creating Color objects for plotting to a bitmap, using either R,G,andB values, or a single integer representing the RGB en

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread Rocco Moretti
scott wrote: > hi people, > > can someone tell me, how to use a class like that* (or "simulate" more > than 1 constructor) : > #-- > class myPointClass: > def __init__(self, x=0, y=0): > self.x = x > self.y = y > def __init__(self, x=0, y=0, z=0): > self.__init__(self, x, y) >

timedelta comparision with gmtime()

2005-06-22 Thread Florian Lindner
Hello, I want to know if a certain duration is over. I try it like this with timedelta objects: d = datetime.timedelta(minutes = 2) t = time.gmtime() print (t + d < time.gmtime()) gives: TypeError: unsupported operand type(s) for +: 'datetime.timedelta' and 'time.struct_time' How to do that rig

Re: Loop until condition is true

2005-06-22 Thread Scott David Daniels
Magnus Lycka wrote: > In some cases, "==" and "is" happens to give the same result. > >>> a = 1 > >>> b = 1 > >>> a == b > 1 > >>> a is b > 1 > > But often not. > > >>> c = 123456789 > >>> d = 123456789 > >>> c == d > 1 > >>> c is d > 0 > ... > First of all, a lot of Python values except

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Scott David Daniels
Grant Edwards wrote: > On 2005-06-22, Scott David Daniels <[EMAIL PROTECTED]> wrote: >>>...Under Win32, the pickle module only works with a subset of >>> floating point values. In particular ... infinity or nan ... >> >>There is no completely portable way to do this. > > Python deals with all sor

Re: Database recommendations for Windows app

2005-06-22 Thread Magnus Lycka
Gregory Piñero wrote: > I always figured a problem with using MySQL was distribution. Would > you have to tell your users to install MySQL and then to leave the > service running? I've never found an easy way to embed MySQL into a > python app, and even if you could, would you then have to pay fo

Re: pickle broken: can't handle NaN or Infinity under win32

2005-06-22 Thread Grant Edwards
On 2005-06-22, Scott David Daniels <[EMAIL PROTECTED]> wrote: >> Fixing it is really quite trivial. It takes less than a dozen >> lines of code. Just catch the exception and handle it. > > Since you know it is quite trivial, and I don't, why not > submit a patch resolving this issue. Be sure to

Re: Database recommendations for Windows app

2005-06-22 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Dan <[EMAIL PROTECTED]> wrote: . . . >> You wouldn't have to distribute the (rather expensive) Access application >> since this is little more than a front for the underlying DAO/ADO database >>

Re: importing a package

2005-06-22 Thread Damjan
> Indeed, when i do this, then it works > import sys > sys.path.append('package') > > However, why is it that package isn't added automatically to the pad? When you execute a python program the directory where the program is is automatically added to sys.path. No other directory is added to the d

Re: Database recommendations for Windows app

2005-06-22 Thread Dave Cook
On 2005-06-22, Cameron Laird <[EMAIL PROTECTED]> wrote: > Are you saying that Python-based applications are particularly > vulnerable in this all-too-common scenario? If so, I'm not > getting it; why is the architecture described more fragile than > more traditional Windows-oriented development p

Re: timedelta comparision with gmtime()

2005-06-22 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED]:~ $ python Use now() from datetime class of datetime module instead of time module. Python 2.4.1 (#2, Mar 30 2005, 21:51:10) [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2 Type "help", "copyright", "credits" or "license" for more information. py> import datetime py> t = datetime

Package organization

2005-06-22 Thread Thomas Lotze
Hi, I've two questions concerning organizing and naming things when writing a Python package. - Naming of classes: I'm writing a library that reads PDF files. I have a data structure that represents the large-scale structure of a PDF file (header, trailer, incremental updates etc), and I'll h

Re: how to use more than 1 __init__ constructor in a class ?

2005-06-22 Thread [EMAIL PROTECTED]
You also could use a list to represent your data, then you get more dimensions supported, e.g: import math class Point: def __init__(self, *args): self.points = list(args) def dist(x, y): if len(x.points) != len(y.points): raise RuntimeError('dimensi

  1   2   3   >