Unit testing daemon creation

2007-03-20 Thread Ben Finney
Howdy all, I'm in the process of creating a daemon program using Python. I know that the program needs to 'os.fork()', then branch based on the return value and either exit (if the parent) or continue (if the child). How can I unit test that? That is to say, how can I programmatically test that f

How to set SA_RESTART flag in Python

2007-03-20 Thread Marco
Hi, I want to set SA_RESTART flag to restart a system-call. How to do this in Python? Thank you! -- LinuX Power -- http://mail.python.org/mailman/listinfo/python-list

How to tell easy_install that a package is already installed

2007-03-20 Thread Charles Sanders
I am not sure if this is the right forum to ask this. If it is not, could someone pleas point me to a more appropriate newsgroup. I am attempting to install dap.plugins.netcdf using easy_install on HP-UX 11. As a user, I do not have access to root so have followed the easy_install recommendation

Re: When is List Comprehension inappropriate?

2007-03-20 Thread Paddy
On Mar 19, 2:41 pm, "Ben" <[EMAIL PROTECTED]> wrote: > I have recently learned how list comprehension works and am finding it > extremely cool. I am worried, however, that I may be stuffing it into > places that it does not belong. > > What's the most "pythony" way to do this: > > even = [] > for

Re: Daylight saving time question

2007-03-20 Thread attn . steven . kuo
On Mar 20, 12:53 pm, Mr Pekka Niiranen <[EMAIL PROTECTED]> wrote: > Hi, > > is it possible to get the two annual daylight saving times > (day, month and time) from Python by giving location > in some country/location string ("Europe/Finland" for example). > > I need to ask country in program and ca

Re: List to string

2007-03-20 Thread Hendrik van Rooyen
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote: On Tue, 20 Mar 2007 13:01:36 +0100, Bruno Desthuilliers wrote: 8< --- confusion about left and right It gets worse. When you work on a lathe, a "right hand cutting tool" has its cutting edge on the left... And the worse part is th

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Carl Douglas
On 20 Mar 2007 23:12:45 -0700, John Pye <[EMAIL PROTECTED]> wrote: > On Mar 21, 4:49 pm, "Carl Douglas" <[EMAIL PROTECTED]> wrote: > > 1) Rebuild Python with a different compiler/linker kit so it links to > > the same CRT as my project, in your case find a mingw built Python.dll > > > > 2) Rebuild

Re: difference between urllib2.urlopen and firefox view 'page source'?

2007-03-20 Thread wesley chun
On Mar 20, 8:33 am, [EMAIL PROTECTED] wrote: > On Mar 20, 1:56 am, Tina I <[EMAIL PROTECTED]> wrote: > > > I am trying to screen scrape some stock data from yahoo, so I am > > > trying to use urllib2 to retrieve the html and beautiful soup for the > > > parsing. > > You can do this fairly easily. I

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
Gabriel, if you think you can make an example that works, that would be great. I'm afraid I feel a bit out of my depth and don't have much confidence in this idea. JP -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
On Mar 21, 4:49 pm, "Carl Douglas" <[EMAIL PROTECTED]> wrote: > 1) Rebuild Python with a different compiler/linker kit so it links to > the same CRT as my project, in your case find a mingw built Python.dll > > 2) Rebuild [with MSVC] OK, so let's say that I must support EXISTING installations of P

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
On Mar 21, 4:48 pm, "John Pye" <[EMAIL PROTECTED]> wrote: > > I am trying the following... any thoughts? > > %typemap(in) FILE * { > if (!PyFile_Check($input)) { > PyErr_SetString(PyExc_TypeError, "Need a file!"); > return NULL; > } > %#ifdef __MINGW32__ > PyFileObje

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Gabriel Genellina
En Wed, 21 Mar 2007 01:58:05 -0300, John Pye <[EMAIL PROTECTED]> escribió: > Hmm. Reading this again I think I understand properly now. The > 'fileno' is really *not* the same thing as the FILE* pointer cast to > an integer. It is a lower-level structure. Just an integer. But as Ross Ridge has poi

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Gabriel Genellina
En Wed, 21 Mar 2007 02:04:30 -0300, Ross Ridge <[EMAIL PROTECTED]> escribió: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: >> You can get the file descriptor from the Python file object using its >> fileno() method. The file descriptor lives at the OS level, so it's safe >> to pass around. > >

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Carl Douglas
Hi John, In my case, all I needed was a PyFile_AsFile to get the File *. However I found that Python errors going to stdout/stderr were not being redirected properly when my code was linking to a different version of the CRT than the build of Python I was using. In the end, I came up with one of

Re: dictionary.copy()?

2007-03-20 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: > Here is some example code: > > d = {"a":"hello", "b":[1, 2, 3]} > > x = d.copy() > d["b"][0]=10 > print x > > output: > {'a': 'hello', 'b': [10, 2, 3]} > > It looks like the key names of a dictionary store pointers to the > values? Or does a dictionary objec

dictionary.copy()?

2007-03-20 Thread 7stud
Here is some example code: d = {"a":"hello", "b":[1, 2, 3]} x = d.copy() d["b"][0]=10 print x output: {'a': 'hello', 'b': [10, 2, 3]} It looks like the key names of a dictionary store pointers to the values? Or does a dictionary object manage pointers to keys and values, so copy() above just c

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
On Mar 21, 4:04 pm, Ross Ridge <[EMAIL PROTECTED]> wrote: > Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >You can get the file descriptor from the Python file object using its > >fileno() method. The file descriptor lives at the OS level, so it's safe > >to pass around. > > Not under Windows. Wi

Looking For Programming Job?

2007-03-20 Thread infobiz_123
Simply Find Your Programming Job Vacancy and resources here --> http://www.jobbankdata.com/job-programming.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Gabriel Genellina
En Wed, 21 Mar 2007 01:30:34 -0300, John Pye <[EMAIL PROTECTED]> escribió: > On Mar 21, 3:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> En Wed, 21 Mar 2007 00:46:03 -0300, John Pye >> <[EMAIL PROTECTED]> escribió: >> >> > This is not an option for me, as I want to pass the >> > FILE*

Re: On Java's Interface (the meaning of interface in computer programing)

2007-03-20 Thread 7stud
No. -- http://mail.python.org/mailman/listinfo/python-list

On Java's Interface (the meaning of interface in computer programing)

2007-03-20 Thread Xah Lee
On Java's Interface Xah Lee, 20050223 In Java the language, there's this a keyword “interface”. In a functional language, a function can be specified by its name and parameter specs. For example: f(3) f(3, [9,2]) f("some string") are usage examples of 3 functions all having the same name, but h

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Ross Ridge
Gabriel Genellina <[EMAIL PROTECTED]> wrote: >You can get the file descriptor from the Python file object using its >fileno() method. The file descriptor lives at the OS level, so it's safe >to pass around. Not under Windows. Windows doesn't have Unix-like descriptors, so the C runtime emulat

Re: Can sqlite read gzipped databases?

2007-03-20 Thread John Nagle
Gzipped files aren't a good random access medium. It's unlikely that anyone will implement this. John Nagle Paul Smith wrote: > Hi, > > I'd like to read a series of sqlite database files that have already been > gzipped and was wondering if this can be done

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
On Mar 21, 3:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 21 Mar 2007 00:46:03 -0300, John Pye > <[EMAIL PROTECTED]> escribió: > > > This is not an option for me, as I want to pass the > > FILE* from Python and all the way into into a existing shared-library > > code. I can't cha

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
On Mar 21, 3:15 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Wed, 21 Mar 2007 00:46:03 -0300, John Pye > <[EMAIL PROTECTED]> escribió: > > > This is not an option for me, as I want to pass the > > FILE* from Python and all the way into into a existing shared-library > > code. I can't cha

Re: How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Gabriel Genellina
En Wed, 21 Mar 2007 00:46:03 -0300, John Pye <[EMAIL PROTECTED]> escribió: > This is not an option for me, as I want to pass the > FILE* from Python and all the way into into a existing shared-library > code. I can't change the latter; it must work ok with standard fprintf > (etc) functions. Yo

Can sqlite read gzipped databases?

2007-03-20 Thread Paul Smith
Hi, I'd like to read a series of sqlite database files that have already been gzipped and was wondering if this can be done on the fly. In other words, can I avoid explicitly unzipping the file into another file, but instead get an SQL connection to the zip file either directly (can't see an op

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-20 Thread John Pye
Hi Carl I'm not sure that your snippet really solves my problem. As far as I can see from, you're just passing a filename instead of a file pointer, right? And then you're using the Python fopen-equivalent (PyFile_FromString) This is not an option for me, as I want to pass the FILE* from Python an

Re: [Swig-user] How to receive a FILE* from Python under MinGW?

2007-03-20 Thread Carl Douglas
Hi John, I had exactly this problem... use the PyFile_AsFile function. Below is a code snippet from my project: // Thank you: http://www.ragestorm.net/tutorial?id=21#8 PyObject* PyFileObject = PyFile_FromString(ofn.lpstrFile, "r"); if (PyFileObje

Re: Documentation for "str()" could use some adjustment - Unicode issue

2007-03-20 Thread Alex Martelli
John Nagle <[EMAIL PROTECTED]> wrote: ... > > Are you looking at p. 109 of the 2nd edition of the Nutshell? > > No, I'm looking at the original edition from 2003. That > was what Borders had in stock late last year. Eeek -- the 2nd edition came out in July 2006, and several months later

Re: mysterious unicode

2007-03-20 Thread jim-on-linux
On Tuesday 20 March 2007 21:17, Carsten Haese wrote: > On Tue, 2007-03-20 at 20:26 -0400, jim-on-linux wrote: > > I have been getting the same thing using > > SQLite3 when extracting data fron an SQLite3 > > database. > > Many APIs that exchange data choose to exchange > text in Unicode because t

Re: No module named ...

2007-03-20 Thread Leif K-Brooks
gtb wrote: > I was having trouble with the 'no module named' error message when > trying to import and noticed that other successful imports were > pulling from .py files that had the dot replaced with $ and .class > appended to the name. Actually in one case it picked up a .pyc file > then created

Re: generating stats from stdout on a regular interval

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 22:45:16 -0300, russ <[EMAIL PROTECTED]> escribió: > Very new to Python - but excited to see what is possible - it sounds > very suitable for a project of mine I need a little help with. > > I've got an executable which writes out data to stdout in a CSV sort > of format - I'

Re: select.poll and winXP

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 22:44:41 -0300, John Pote <[EMAIL PROTECTED]> escribió: > I have the standard Python 2.4.4 windows download installed on my win XP > box. But the poll class in module select is not available. The docs > indicate > that it can work with windows as long as only sockets are us

generating stats from stdout on a regular interval

2007-03-20 Thread russ
Hi all, Very new to Python - but excited to see what is possible - it sounds very suitable for a project of mine I need a little help with. I've got an executable which writes out data to stdout in a CSV sort of format - I'd like to grab the data from stdout and create stats from it at a regular

select.poll and winXP

2007-03-20 Thread John Pote
Hi all, I have the standard Python 2.4.4 windows download installed on my win XP box. But the poll class in module select is not available. The docs indicate that it can work with windows as long as only sockets are used which is fine for me. Is there a reason it's not in the standard build, c

Re: Idiom for running compiled python scripts?

2007-03-20 Thread Max Erickson
Mark <[EMAIL PROTECTED]> wrote: ... > #!/usr/bin/env python > from myprog import main > if __name__ == "__main__": > main() > > Of course this compiles myprog.py into myprog.pyc on first run as > I am wanting. > > I have one of these stubs for all my python scripts I've created > so far. Is

Re: Imports

2007-03-20 Thread Steve Holden
7stud wrote: > On Mar 20, 6:33 pm, "7stud" <[EMAIL PROTECTED]> wrote: >> On Mar 20, 12:51 pm, [EMAIL PROTECTED] wrote: >> >>> I typically just import sys and then do a >>> sys.path.append(directoryPath). This basically makes whatever modules >>> in that path available at run time. If you need a beg

Re: mysterious unicode

2007-03-20 Thread Carsten Haese
On Tue, 2007-03-20 at 20:26 -0400, jim-on-linux wrote: > I have been getting the same thing using SQLite3 > when extracting data fron an SQLite3 database. Many APIs that exchange data choose to exchange text in Unicode because that eliminates encoding uncertainty. Whether an API uses Unicode woul

Re: Idiom for running compiled python scripts?

2007-03-20 Thread Bjoern Schliessmann
Mark wrote: > E.g. say I have a python script "myprog.py". I could just execute > that directly each time but that means it is "compiled" each time > I run it which is not efficient and adds to startup time. Did you measure the performance hit in your case? > I have one of these stubs for all m

Re: Subject line with smtplib.sendmail()

2007-03-20 Thread Ben Finney
"Gabriel Genellina" <[EMAIL PROTECTED]> writes: > Perhaps you are using an """indented > triple quoted > string""" ? > > The indentation goes into the string itself. You may use a global > (module) constant to hold the string, by example. Rather than letting technical issues dic

Looking for the Hilarious Bush Putin photo, holding hands like soul mates with adorable expression on Putin's face

2007-03-20 Thread thermate
Here is one version of the picture at the occasion http://news.bbc.co.uk/2/hi/europe/1392791.stm but there was a much better full page photo in newsweek or the Times or some such magazine. Can any kind who remembers what I am talking about help locate that picture on the web? Thermate On Mar 1

Re: Imports

2007-03-20 Thread 7stud
On Mar 20, 6:33 pm, "7stud" <[EMAIL PROTECTED]> wrote: > On Mar 20, 12:51 pm, [EMAIL PROTECTED] wrote: > > > I typically just import sys and then do a > > sys.path.append(directoryPath). This basically makes whatever modules > > in that path available at run time. If you need a beginners reference

Idiom for running compiled python scripts?

2007-03-20 Thread Mark
Hi, I'm new to python and looking for a better idiom to use for the manner I have been organising my python scripts. I've googled all over the place about this but found absolutely nothing. I'm a linux/unix command line guy quite experienced in shell scripts etc. I have a heap of command line util

Re: mysterious unicode

2007-03-20 Thread Carsten Haese
On Tue, 2007-03-20 at 16:47 -0700, Gerry wrote: > I'm still mystified why: >qno was ever unicode, Thus quoth http://www.lexicon.net/sjmachin/xlrd.html "This module presents all text strings as Python unicode objects." -Carsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Imports

2007-03-20 Thread 7stud
On Mar 20, 12:51 pm, [EMAIL PROTECTED] wrote: > I typically just import sys and then do a > sys.path.append(directoryPath). This basically makes whatever modules > in that path available at run time. If you need a beginners reference > book, I recommend "Beginning Python" by Hetland. "Python Progra

Re: mysterious unicode

2007-03-20 Thread jim-on-linux
On Tuesday 20 March 2007 18:35, Gerry wrote: > I'm using pyExcelerator and xlrd to read and > write data from and to two spreadsheets. > > I created the "read" spreadsheet by importing a > text file - and I had no unicode aspirations. > > When I read a cell, it appears to be unicode > u'Q1", say. >

PyImport_ImportModule/embedding: surprising behaviors

2007-03-20 Thread David Abrahams
I'm seeing highly surprising (and different!) behaviors of PyImport_ImportModule on Linux and Windows when used in a program with python embedding. On Linux, when attempting to import a module xxx that's in the current directory, I get ImportError: No module named xxx I can work around the pr

Re: mysterious unicode

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 20:47:22 -0300, Gerry <[EMAIL PROTECTED]> escribió: > Thanks! - that helps a lot. > > I'm still mystified why: >qno was ever unicode, and why I can't tell... >qno.encode("ascii", "replace") is still unicode. That *returns* a string, but you are discarding the retur

Re: mysterious unicode

2007-03-20 Thread Gerry
On Mar 20, 7:29 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Tue, 20 Mar 2007 19:35:00 -0300, Gerry <[EMAIL PROTECTED]> > escribió: > Thanks! - that helps a lot. I'm still mystified why: qno was ever unicode, and why qno.encode("ascii", "replace") is still unicode. Gerry > >

Re: mysterious unicode

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 19:35:00 -0300, Gerry <[EMAIL PROTECTED]> escribió: > which seems to work. Here's the mysterious part (aside from why > anything was unicode in the first place): > > print >> debug, "c=", col, "r=", row, "v=", value, > "qno=", qno > tuple = (q

Re: Imports

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 16:25:41 -0300, <[EMAIL PROTECTED]> escribió: > Usually, the sys.path.append will allow Python to search the > subfolders too, but I have noticed that sometimes it doesn't if you > use UNC paths. I don't use jython, so maybe there's another way to fix > this that is more specif

Re: Subject line with smtplib.sendmail()

2007-03-20 Thread Gabriel Genellina
En Tue, 20 Mar 2007 15:18:01 -0300, Boudreau, Emile <[EMAIL PROTECTED]> escribió: > Sorry folks. Scrape the last one that I sent. I noticed that it sends > the email perfectly if the code is not in any of my methods but the > second I insert it into a method I get the ugly email that I described

mysterious unicode

2007-03-20 Thread Gerry
I'm using pyExcelerator and xlrd to read and write data from and to two spreadsheets. I created the "read" spreadsheet by importing a text file - and I had no unicode aspirations. When I read a cell, it appears to be unicode u'Q1", say. I can try cleaning it, like this: try: s.enco

Re: Exceptions when closing a file

2007-03-20 Thread Ben Finney
John Nagle <[EMAIL PROTECTED]> writes: > If you want to force [an error while closing a file], write to > a drive reached over a network, or a removable medium like a floppy > or flash card. Open a file for writing and disconnect the network > or remove the removable medium. Or simply use a

Re: help - Module needs access to another module

2007-03-20 Thread Ben Finney
"abcd" <[EMAIL PROTECTED]> writes: > On Mar 20, 9:58 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > http://docs.python.org/tut/node8.html > > got it, thanks. Now that you've got that one part of the tutorial, please do *the whole thing*. Start from the beginning, run each example and watch

ANN: Pyro 3.6 (remote objects)

2007-03-20 Thread Irmen de Jong
I'm happy to announce Pyro 3.6 -- Python's own powerful remote method invocation technology! You can get it via http://pyro.sourceforge.net, then go to the SF project homepage download area. It has many new features and improvements over Pyro 3.5, which was released more than a year ago. (Sor

No module named ...

2007-03-20 Thread gtb
I was having trouble with the 'no module named' error message when trying to import and noticed that other successful imports were pulling from .py files that had the dot replaced with $ and .class appended to the name. Actually in one case it picked up a .pyc file then created a .class file. How

Re: How to copy a ClassObject?

2007-03-20 Thread Peter Otten
Stargaming wrote: > Leave out the `new` module and use `type()` (exactly the same call as to > `new.classobj`) to achieve the same effect. No. new.classobj() creates a classic class whereas type() creates a new-style class. Also, >>> class First: pass ... >>> type("Tmp", (First,), {}) Tracebac

Re: Imports

2007-03-20 Thread gtb
On Mar 20, 2:25 pm, [EMAIL PROTECTED] wrote: > On Mar 20, 1:59 pm, "gtb" <[EMAIL PROTECTED]> wrote: > > > > > On Mar 20, 1:51 pm, [EMAIL PROTECTED] wrote: > > > > On Mar 20, 1:31 pm, "gtb" <[EMAIL PROTECTED]> wrote: > > > > > I am working with a tool called maxQ that generates jython scripts. > > >

Re: Exceptions when closing a file

2007-03-20 Thread kyosohma
On Mar 20, 4:26 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > > > > On Mar 20, 12:25 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: > > >>Closing a file can (I believe) raise an exception. Is that documented > >>anywhere? I've spent a lot of frustrating ti

Re: Exceptions when closing a file

2007-03-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Mar 20, 12:25 pm, Steven D'Aprano > <[EMAIL PROTECTED]> wrote: > >>Closing a file can (I believe) raise an exception. Is that documented >>anywhere? I've spent a lot of frustrating time trying to track this down, >>with no luck, which suggests that either my google

Re: any ways to judge whether an object is initilized or not in a class

2007-03-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > >Not officially yet, true. But come on, it's been 6 (six) years since >type unification, and it has always been obvious (to me at least) that >the new object model was to replace the 'classic' one. ...in Python 3.0

Re: any ways to judge whether an object is initilized or not in a class

2007-03-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers wrote: > > [deploying weapons of mass snippage] Lol !-) > >>>Otherwise, the choice between old >>>and new is not very important. >> >>Your opinion. Too bad you're missing some of the most powerful parts of >>th

Re: any ways to judge whether an object is initilized or not in a class

2007-03-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : > On Tue, 20 Mar 2007 10:28:10 +0100, Bruno Desthuilliers complained about > classic classes: > > >>>What's wrong with old-style classes? >> >>Almost everything. > > > That's rather an exaggeration, don't you think? Oh, really ?-) -- http://mail.python.org/mailman/l

Re: #!/usr/bin/env python > 2.4?

2007-03-20 Thread rh0dium
On Mar 20, 12:30 pm, Stargaming <[EMAIL PROTECTED]> wrote: > > from sys import version_info > if version_info[0] < 2 or version_info[1] < 4: > raise RuntimeError("You need at least python2.4 to run this script") This is great!! > > IMO you shouldn't struggle with it too hard. If the user's p

Patchs and bugs resume

2007-03-20 Thread Facundo Batista
People: At the beginning of March, there was a thread in python-dev about patchs and bugs that teorically weren't checked out. The thread discussed how to involve more people in checking patchs and bugs, and to create other dinamic around them. >From that discussion, I asked myself: "How can I

Re: Daylight saving time question

2007-03-20 Thread kyosohma
On Mar 20, 2:53 pm, Mr Pekka Niiranen <[EMAIL PROTECTED]> wrote: > Hi, > > is it possible to get the two annual daylight saving times > (day, month and time) from Python by giving location > in some country/location string ("Europe/Finland" for example). > > I need to ask country in program and cal

Daylight saving time question

2007-03-20 Thread Mr Pekka Niiranen
Hi, is it possible to get the two annual daylight saving times (day, month and time) from Python by giving location in some country/location string ("Europe/Finland" for example). I need to ask country in program and calculate daylight saving times for the next few years onwards somehow like this

Re: Documentation for "str()" could use some adjustment - Unicode issue

2007-03-20 Thread John Nagle
Alex Martelli wrote: > John Nagle <[EMAIL PROTECTED]> wrote: >... > >>The real problem is the published books on Python: >> >>"Learning Python", by Lutz and Ascher: >>"str(string) -- returns the string representation of any object." >> >>"Python in a Nutshell", by Martelli >>Doesn'

Re: How to copy a ClassObject?

2007-03-20 Thread Stargaming
Karlo Lozovina schrieb: > Karlo Lozovina <[EMAIL PROTECTED]> wrote in > news:[EMAIL PROTECTED]: > > >>how would one make a copy of a class object? Let's say I have: >> class First: >>name = 'First' >> >>And then I write: >> tmp = First > > > Silly me, posted a question without Googling f

Re: #!/usr/bin/env python > 2.4?

2007-03-20 Thread Stargaming
rh0dium schrieb: >>Python usually installs so the latest version gets linked as >>/usr/bin/python. HTere's no need to bind your scripts to a particular >>version. >> >>regards > > > True - but that entirely depends on your path. Example: > > Redhat (RHEL3) ships with python2.3 in /usr/bin > Add

Re: Imports

2007-03-20 Thread kyosohma
On Mar 20, 1:59 pm, "gtb" <[EMAIL PROTECTED]> wrote: > On Mar 20, 1:51 pm, [EMAIL PROTECTED] wrote: > > > > > On Mar 20, 1:31 pm, "gtb" <[EMAIL PROTECTED]> wrote: > > > > I am working with a tool called maxQ that generates jython scripts. > > > The tool runs in > > > > C:\maxq\bin. > > > > Rather t

socket.getfqdn deadlock

2007-03-20 Thread vvikram
Hi, I am getting deadlocks (backtrace pasted below) after a while at, presumably, a socket.getfqdn() call in a child process . Fwiw: This child process is created as the result of a pyro call to a Pyro object. Any ideas why this is happening? Thanks. Regards, Vikram --- Machine info: Linux ab

Re: making objects with individual attributes!

2007-03-20 Thread Alejandro
Thanks to all!!! Now it works! -- http://mail.python.org/mailman/listinfo/python-list

Re: Imports

2007-03-20 Thread gtb
On Mar 20, 1:51 pm, [EMAIL PROTECTED] wrote: > On Mar 20, 1:31 pm, "gtb" <[EMAIL PROTECTED]> wrote: > > > > > I am working with a tool called maxQ that generates jython scripts. > > The tool runs in > > > C:\maxq\bin. > > > Rather than clutter up bin I want to put the scripts and other .py > > scri

Re: Imports

2007-03-20 Thread kyosohma
On Mar 20, 1:31 pm, "gtb" <[EMAIL PROTECTED]> wrote: > I am working with a tool called maxQ that generates jython scripts. > The tool runs in > > C:\maxq\bin. > > Rather than clutter up bin I want to put the scripts and other .py > scripts in > > c:\maxq\bin\testScripts. > > When doing so the scrip

freeze.py and dom.minidom

2007-03-20 Thread Greg Copeland
I am attempting to freeze an application which uses the dom.minidom parser. When I execute my application, I get an import error of: ImportError: No module named dom.minidom. During the freeze process, I can see: freezing xml ... freezing xml.dom ... freezing xml.dom.NodeFilter ... freezing xml.d

Re: Yanqui bastards OPERATED 911 RACIST and HEINOUS CRIME Re: +++ Russia Watched 9/11 In REAL TIME on SATELLITE +++

2007-03-20 Thread Tonico
On 20 mar, 19:14, [EMAIL PROTECTED] wrote: > Yank Bastards: Hi! * > What evidence do you have for the 19 hijackers ? Uh? * > What explanation do you have for thermate products ? Uh + Uh ???*** > What

Imports

2007-03-20 Thread gtb
I am working with a tool called maxQ that generates jython scripts. The tool runs in C:\maxq\bin. Rather than clutter up bin I want to put the scripts and other .py scripts in c:\maxq\bin\testScripts. When doing so the scripts need to import from c:\maxq\jython, but can't find the modules.

Re: Exceptions when closing a file

2007-03-20 Thread John Nagle
Ross Ridge wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > >>Closing a file can (I believe) raise an exception. Is that documented >>anywhere? > > > In a catch-all statement for file objects: "When a file operation fails > for an I/O-related reason, the exception IOError is raised." The

Re: #!/usr/bin/env python > 2.4?

2007-03-20 Thread rh0dium
> Python usually installs so the latest version gets linked as > /usr/bin/python. HTere's no need to bind your scripts to a particular > version. > > regards True - but that entirely depends on your path. Example: Redhat (RHEL3) ships with python2.3 in /usr/bin Adding an 2.5 version to /usr/loc

RE: Subject line with smtplib.sendmail()

2007-03-20 Thread Boudreau, Emile
Sorry folks. Scrape the last one that I sent. I noticed that it sends the email perfectly if the code is not in any of my methods but the second I insert it into a method I get the ugly email that I described in my last email. Does anyone know how I can get this code in my method so that I have a

Re: Subject line with smtplib.sendmail()

2007-03-20 Thread kyosohma
On Mar 20, 12:50 pm, "Boudreau, Emile" <[EMAIL PROTECTED]> wrote: > Thanks for the reply. When I use the instruction from that list this is > the email I receive. I'm using Outlook. > > [EMAIL PROTECTED] > To: > -- > From: [EMAIL PROTECTED] > To: [EMAIL P

Re: Exceptions when closing a file

2007-03-20 Thread Ross Ridge
Steven D'Aprano <[EMAIL PROTECTED]> wrote: >Closing a file can (I believe) raise an exception. Is that documented >anywhere? In a catch-all statement for file objects: "When a file operation fails for an I/O-related reason, the exception IOError is raised." The fact that close() is a file opera

Re: Exceptions when closing a file

2007-03-20 Thread kyosohma
On Mar 20, 12:25 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > Closing a file can (I believe) raise an exception. Is that documented > anywhere? I've spent a lot of frustrating time trying to track this down, > with no luck, which suggests that either my google-foo is weak or that it > isn't doc

Re: if __name__ == 'main':

2007-03-20 Thread gtb
On Mar 20, 12:13 pm, "Patrick Down" <[EMAIL PROTECTED]> wrote: > On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I often see the following 'if' construct in python code. What does > > this idiom accomplish? What happens if this is not main? How did I get > > here if it is not

RE: Subject line with smtplib.sendmail()

2007-03-20 Thread Boudreau, Emile
Thanks for the reply. When I use the instruction from that list this is the email I receive. I'm using Outlook. [EMAIL PROTECTED] To: -- From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Hello! This Still DOESN't Work

Re: Anything available that can read Microsoft .MDB files from Python?

2007-03-20 Thread John Nagle
Shane Geiger wrote: > Try installing it from source. Perhaps getting a newer verion is all > you would need. If at that point you find there is a bug, report it. I did. I finally got MDBtools to build by throwing out all the "configure" stuff and the makefiles, then writing some simple

Re: Wanted: a python24 package for Python 2.3

2007-03-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: > >For subprocess specifically, see > . I don't think anybody's >ever packaged up ALL the new stuff as you require. Oh, good that web page came back. (When we were down to the wir

Re: difference between urllib2.urlopen and firefox view 'page source'?

2007-03-20 Thread John Nagle
Here's a useful online tool that might help you see what's happening: http://www.sitetruth.com/experimental/viewer.html We use this to help webmasters see what our web crawler is seeing. This reads a page, using Python and FancyURLOpener, with a USER-AGENT string of "SiteTruth.co

Choosing new-style vs classic classes (was Re: any ways to judge whether an object is initilized or not in a class)

2007-03-20 Thread Aahz
In article <[EMAIL PROTECTED]>, Steven D'Aprano <[EMAIL PROTECTED]> wrote: >On Tue, 20 Mar 2007 08:27:07 -0700, Alex Martelli wrote: >> >> You should always use new-style classes in order to avoid having to stop >> and make a decision each time you code a class -- having to stop and ask >> yoursel

Exceptions when closing a file

2007-03-20 Thread Steven D'Aprano
Closing a file can (I believe) raise an exception. Is that documented anywhere? I've spent a lot of frustrating time trying to track this down, with no luck, which suggests that either my google-foo is weak or that it isn't documented. Is IOError the only exception it can raise? The only thing I h

Re: List to string

2007-03-20 Thread Josh Bloom
That's pretty funny :) On 3/20/07, Steven D'Aprano <[EMAIL PROTECTED]> wrote: On Tue, 20 Mar 2007 13:01:36 +0100, Bruno Desthuilliers wrote: > Steven D'Aprano a écrit : >> On Mon, 19 Mar 2007 13:11:09 +0100, Bruno Desthuilliers wrote: >> >>> There's no "cast" in Python. It would make no sens i

Re: an enumerate question

2007-03-20 Thread Paulo da Silva
[EMAIL PROTECTED] escreveu: > hi > say i want to enumerate lines of a file > eg > for n,l in enumerate(open("file")): > # print next line ie > > is there a way to print out the next line from current line using the > above?. > Or do i have to do a readlines() first to get it into a list eg >

Yanqui bastards OPERATED 911 RACIST and HEINOUS CRIME Re: +++ Russia Watched 9/11 In REAL TIME on SATELLITE +++

2007-03-20 Thread thermate
Yank Bastards: What evidence do you have for the 19 hijackers ? What explanation do you have for thermate products ? What evidence do INCOMPETENT Graduates of the FBI Academy have for the suicide of building 7 ? Why were FBI rats running around to confiscate the evidence of missile hitting the

Re: if __name__ == 'main':

2007-03-20 Thread Patrick Down
On Mar 20, 11:49 am, "gtb" <[EMAIL PROTECTED]> wrote: > Hi, > > I often see the following 'if' construct in python code. What does > this idiom accomplish? What happens if this is not main? How did I get > here if it is not main? A quick example demonstrates the usage: C:\code>type temp.py prin

Re: any ways to judge whether an object is initilized or not in a class

2007-03-20 Thread Steven D'Aprano
On Tue, 20 Mar 2007 08:27:07 -0700, Alex Martelli wrote: > You should always use new-style classes in order to avoid having to stop > and make a decision each time you code a class -- having to stop and ask > yourself "do I need any of the many extra features of new-style classes > here, or will l

Re: if __name__ == 'main':

2007-03-20 Thread Grant Edwards
On 2007-03-20, gtb <[EMAIL PROTECTED]> wrote: > I often see the following 'if' construct in python code. What does > this idiom accomplish? It checks to see if the file is being run as the "main" program, and does something if that is so. > What happens if this is not main? Nothing. > How did

Re: if __name__ == 'main':

2007-03-20 Thread Facundo Batista
gtb wrote: > I often see the following 'if' construct in python code. What does > this idiom accomplish? What happens if this is not main? How did I get > here if it is not main? > ... > if __name__ == 'main': >myQuest('myQuest').Run() This idiom is for executing the code if you're running t

  1   2   >