Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"Patrick Maupin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Question: I have Python modules named without '.py' as the extension, > > and I'd like to be able to import them. How can I do that? > > This is a piece of cake in Python. > > >>> from types import ModuleType > >>> x = ModuleTy

Re: import help

2006-08-07 Thread Rob Wolfe
placid wrote: > Hi all, > > How do i import a module that has an hypen/dash (-) in its name ? I get > a SytaxError exception You can use function __import__. >>> print open("-test.py").read() def fun2(): return "Hello from -test !" >>> import -test File "", line 1 import -test

Re: import help

2006-08-07 Thread Gary Herron
placid wrote: > Hi all, > > How do i import a module that has an hypen/dash (-) in its name ? I get > a SytaxError exception > > Cheers > > You can't do that directly. However, the internals of the import mechanism are available to the programmer through a module named imp. It allows you to im

import help

2006-08-07 Thread placid
Hi all, How do i import a module that has an hypen/dash (-) in its name ? I get a SytaxError exception Cheers -- http://mail.python.org/mailman/listinfo/python-list

Re: Static Variables in Python?

2006-08-07 Thread Paddy
Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Paddy <[EMAIL PROTECTED]> wrote: > . > [substantial thread > with many serious > alternatives] > . > . > >You can do things with func

Re: access abook addressbook with curses

2006-08-07 Thread Fabian Braennstroem
Hi Ben, * Ben C <[EMAIL PROTECTED]> wrote: > On 2006-08-06, Fabian Braennstroem <[EMAIL PROTECTED]> wrote: >> Hi Ben, >> >> * Ben C <[EMAIL PROTECTED]> wrote: >>> On 2006-08-05, Fabian Braennstroem <[EMAIL PROTECTED]> wrote: Hi, I want to get access to my abook address file with pyt

Re: email client like mutt

2006-08-07 Thread Fabian Braennstroem
Hi to both, * cga2000 <[EMAIL PROTECTED]> wrote: > On Mon, Aug 07, 2006 at 08:34:16PM EDT, Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> cga2000 <[EMAIL PROTECTED]> wrote: >> >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: >> >> In article <[EMAIL PROTECTED]>, >> >> Fabian Braennstroem

Re: using python at the bash shell?

2006-08-07 Thread Simon Forman
[EMAIL PROTECTED] wrote: > John> Aside from the normal commands you can use, I was wondering if > John> it's possible to use Python from the terminal instead of the > John> normal bash commands (e.g. print instead of echo). > > Take a look at ipython . It's not p

Re: Import module with non-standard file name

2006-08-07 Thread Simon Forman
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with no extension. This allows other program

Re: Question on try/except

2006-08-07 Thread Patrick Maupin
Kirk McDonald wrote: > Dan wrote: > > Is there some particular use in catching an exception and immediately > > re-raising it? Why catch it at all? > > All I can think of is that it changes the traceback to point to the > re-raise and not the original raise. I've used this technique before. It

Re: Import module with non-standard file name

2006-08-07 Thread Patrick Maupin
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? This is a piece of cake in Python. >>> from types import ModuleType >>> x = ModuleType('myModName') >>> data = open('myfilename').

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Patrick Maupin
Diez B. Roggisch wrote: > Martin Höfling wrote: > > > is it possible to put the methods of a class in different files? I just > > want to order them and try to keep the files small. > > No, its not possible. What you can do is to create several classes and one > that inherits from all of them. > >

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 15:41 +0200, Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > Here's how I do it: Firstly, I create a file called imports.py which contains all my import s

Re: Question on try/except

2006-08-07 Thread Kirk McDonald
Dan wrote: > While perusing sre.py in the standard library, I came upon this snippet > of code in the _compile() function definition: > > try: > p = sre_compile.compile(pattern, flags) > except error, v: > raise error, v # invalid expression > > Is there some particular u

Question on try/except

2006-08-07 Thread Dan
While perusing sre.py in the standard library, I came upon this snippet of code in the _compile() function definition: try: p = sre_compile.compile(pattern, flags) except error, v: raise error, v # invalid expression Is there some particular use in catching an excepti

Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"John Machin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > "John Machin" <[EMAIL PROTECTED]> writes: > > > If it can [modify sys.path], it can copy the MUT to some temp > > > directory, adding .py to the end of the name of the new file, > > > and put the temp directory in sys.path can'

Re: Import module with non-standard file name

2006-08-07 Thread John McMonagle
On Tue, 2006-08-08 at 11:06 +1000, Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with n

Re: Import module with non-standard file name

2006-08-07 Thread John Machin
Ben Finney wrote: > "John Machin" <[EMAIL PROTECTED]> writes: > > > Ben Finney wrote: > > > Now that I've got it written as a Python module, I'd like to write > > > unit tests for that module, which of course will need to import > > > the program module to test it. The unit test can explicitly add

Changing UNIX tty driver keys -- Suggested changes to "termios" module

2006-08-07 Thread Derek Peschel
Should I add an RFE to SourceForge too? I'd like a wide audience in case someone has enough experience to comment or is solving the same problem. I'm using the urwid library which uses curses. On my system (Mac OS 10.3.7) I specifically have ncurses. The programs I'm running turn off echoing an

Re: Import module with non-standard file name

2006-08-07 Thread Ben Finney
"John Machin" <[EMAIL PROTECTED]> writes: > Ben Finney wrote: > > Now that I've got it written as a Python module, I'd like to write > > unit tests for that module, which of course will need to import > > the program module to test it. The unit test can explicitly add > > the directory where the p

Re: email client like mutt

2006-08-07 Thread cga2000
On Mon, Aug 07, 2006 at 08:34:16PM EDT, Aahz wrote: > In article <[EMAIL PROTECTED]>, > cga2000 <[EMAIL PROTECTED]> wrote: > >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: > >> In article <[EMAIL PROTECTED]>, > >> Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > >>> > >>>I am looking for a

Re: Import module with non-standard file name

2006-08-07 Thread John Machin
Ben Finney wrote: > Howdy all, > > Question: I have Python modules named without '.py' as the extension, > and I'd like to be able to import them. How can I do that? > > Background: > > On Unix, I write programs intended to be run as commands to a file > with no extension. This allows other progra

Re: using python at the bash shell?

2006-08-07 Thread skip
John> Aside from the normal commands you can use, I was wondering if John> it's possible to use Python from the terminal instead of the John> normal bash commands (e.g. print instead of echo). Take a look at ipython . It's not precisely what you've asked f

Re: Python open a named pipe == hanging?

2006-08-07 Thread Alex Martelli
Donn Cave <[EMAIL PROTECTED]> wrote: ... > > > I believe your problem is that, by the time you open the > > > pipe for read, it has already been closed by its writer. > > > > Hmmm, no: the problem is, he never opens the pipe for write, because the > > open blocks (will not proceed until somebod

Re: using python at the bash shell?

2006-08-07 Thread John McMonagle
On Mon, 2006-08-07 at 21:03 -0400, John Salerno wrote: > Hi all. I just installed Ubuntu and I'm learning how to use the bash > shell. Aside from the normal commands you can use, I was wondering if > it's possible to use Python from the terminal instead of the normal bash > commands (e.g. print

Import module with non-standard file name

2006-08-07 Thread Ben Finney
Howdy all, Question: I have Python modules named without '.py' as the extension, and I'd like to be able to import them. How can I do that? Background: On Unix, I write programs intended to be run as commands to a file with no extension. This allows other programs to use the command as an interf

using python at the bash shell?

2006-08-07 Thread John Salerno
Hi all. I just installed Ubuntu and I'm learning how to use the bash shell. Aside from the normal commands you can use, I was wondering if it's possible to use Python from the terminal instead of the normal bash commands (e.g. print instead of echo). My main reason for asking is that I like usi

Re: python - HTML processing - need tips

2006-08-07 Thread Gabriel Genellina
At Monday 7/8/2006 20:58, wipit wrote: I need to process a HTML form in python. I'm using urllib2 and HTMLParser to handle the html. There are several steps I need to take to get to the specific page on the relevant site the first of which is to log in with a username/password. The html code tha

Re: email client like mutt

2006-08-07 Thread Aahz
In article <[EMAIL PROTECTED]>, cga2000 <[EMAIL PROTECTED]> wrote: >On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: >> In article <[EMAIL PROTECTED]>, >> Fabian Braennstroem <[EMAIL PROTECTED]> wrote: >>> >>>I am looking for a python email client for the terminal... something like >>>mutt; ma

Re: A problem from a Vim user

2006-08-07 Thread BartlebyScrivener
manuhack wrote: > However, when I run > the same command in vim 7 as :py raw_input('Please type something.\n'), > there is an EOFError: EOF when reading a line. Is there a way to use > that command within vim without raising errors? I thought you might get more help here than in comp.editors ;)

Four issue trackers submitted for Infrastructue Committee's tracker search

2006-08-07 Thread Brett Cannon
Back in June, the Python Software Foundation's Infrastructure Committee asked for help in the search for a new issue tracker to replace SourceForge (see http://wiki.python.org/moin/CallForTrackers for details). We asked people who wished to help with the search to install their favourite issue tra

Re: singleton decorator

2006-08-07 Thread Pedro Werneck
On Tue, 8 Aug 2006 01:33:31 +0200 "Andre Meyer" <[EMAIL PROTECTED]> wrote: > > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? I think the most "elegant" is with a metaclass, since I feel like a singleton is not just an ordinary type (and __

Re: singleton decorator

2006-08-07 Thread Erik Max Francis
Andre Meyer wrote: > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? Create a class and then derive from it. There are examples on the Cookbook. -- Erik Max Francis && [EMAIL PROTECTED] && http://www.alcyone.com/max/ San Jose, CA, USA &

Re: do people really complain about significant whitespace?

2006-08-07 Thread Jim
> He points out that if some code gets accidentally dedented, it is > difficult for another programmer to determine which lines were supposed > to be in the indented block. I pointed out that if someone > accidentally moves a curly brace, the same problem can occur. > Anecdotally, I've never had e

Re: do people really complain about significant whitespace?

2006-08-07 Thread bearophileHUGS
Jason wrote: > But newsgroup managers are certainly an issue. > For comment thingies online, the preformat tag is your friend, too. Time ago I used to add a | or something similar at the beginning of lines, to avoid the leading whitespace stripping done by Google Groups. Other (silly) solutions ar

python - HTML processing - need tips

2006-08-07 Thread wipit
I need to process a HTML form in python. I'm using urllib2 and HTMLParser to handle the html. There are several steps I need to take to get to the specific page on the relevant site the first of which is to log in with a username/password. The html code that processes the login consists of 2 edit b

Re: singleton decorator

2006-08-07 Thread bearophileHUGS
Andre Meyer: > What is the preferred pythonic way of implementing singleton elegantly? Maybe to just use a module. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: do people really complain about significant whitespace?

2006-08-07 Thread Jason
[EMAIL PROTECTED] wrote: > Jason wrote: > > He points out that if some code gets accidentally dedented, it is > > difficult for another programmer to determine which lines were supposed > > to be in the indented block. I pointed out that if someone > > accidentally moves a curly brace, the same pr

Re: do people really complain about significant whitespace?

2006-08-07 Thread Ben Finney
"infidel" <[EMAIL PROTECTED]> writes: > It just sounds like so much trivial nitpickery that it's hard to > believe it's as common as we've come to believe. As others have pointed out, these people really do exist, and they each believe their preconception -- that significant whitespace is intrins

Re: singleton decorator

2006-08-07 Thread Farshid Lashkari
Andre Meyer wrote: > Am I missing something here? What is the preferred pythonic way of > implementing singleton elegantly? The "Open Issues" section of that PEP says the following: "It's exceedingly unlikely that class decorators will be in Python 2.4" So it might not be in the current version

singleton decorator

2006-08-07 Thread Andre Meyer
While looking for an elegant implementation of the singleton design pattern I came across the decorator as described in PEP318.Unfortunately, the following does not work, because decorators only work on functions or methods, but not on classes. def singleton(cls):instances = {}def getinstan

Re: Subtyping a non-builtin type in C/C++

2006-08-07 Thread johan2sson
Martin v. Löwis wrote: > [EMAIL PROTECTED] schrieb: > > I am trying to create a subclass of a python class, defined in python, > > in C++, but I am having some problems. > > Is the base class a classic class or a new-style class? Depending on > the answer, the code you should write varies significa

Re: A problem from a Vim user

2006-08-07 Thread Luis Armendariz
manuhack wrote: > When I use raw_input('Please type something.\n') in the python 2.4 > command line windows, it doesn't have any problem. However, when I run > the same command in vim 7 as :py raw_input('Please type something.\n'), > there is an EOFError: EOF when reading a line. Is there a way t

Re: do people really complain about significant whitespace?

2006-08-07 Thread bearophileHUGS
Jason wrote: > He points out that if some code gets accidentally dedented, it is > difficult for another programmer to determine which lines were supposed > to be in the indented block. I pointed out that if someone > accidentally moves a curly brace, the same problem can occur. I like significan

Re: do people really complain about significant whitespace?

2006-08-07 Thread John Machin
infidel wrote: > Where are they-who-hate-us-for-our-whitespace? Are "they" really that > stupid/petty? Are "they" really out there at all? "They" almost sound > like a mythical caste of tasteless heathens that "we" have invented. All societies demonise outsiders to some extent. It's an unfortu

Class attributes, instances and metaclass __getattribute__

2006-08-07 Thread Pedro Werneck
Hi all I noticed something strange here while explaining decorators to someone. Not any real use code, but I think it's worth mentioning. When I access a class attribute, on a class with a custom metaclass with a __getattribute__ method, the method is used when acessing some attribute directly

Re: do people really complain about significant whitespace?

2006-08-07 Thread crystalattice
infidel wrote: > Where are they-who-hate-us-for-our-whitespace? Are "they" really that > stupid/petty? Are "they" really out there at all? "They" almost sound > like a mythical caste of tasteless heathens that "we" have invented. > It just sounds like so much trivial nitpickery that it's hard to

Re: do people really complain about significant whitespace?

2006-08-07 Thread Jason
infidel wrote: > Where are they-who-hate-us-for-our-whitespace? Are "they" really that > stupid/petty? Are "they" really out there at all? "They" almost sound > like a mythical caste of tasteless heathens that "we" have invented. > It just sounds like so much trivial nitpickery that it's hard to

Re: Getting previous file name

2006-08-07 Thread John Machin
Hitesh wrote: > Hi, > > I have a small script here that goes to inside dir and sorts the file > by create date. I can return the create date but I don't know how to > find the name of that file... > I need file that is not latest but was created before the last file. > Any hints... I am newbiw pyth

Re: Python Projects Continuous Integration

2006-08-07 Thread Grig Gheorghiu
Ziga Seilnacht wrote: > Dave Potts wrote: > > Hi, > > > > I'm just starting a development project in Python having spent time in > > the Java world. I was wondering what tool advice you could give me > > about setting up a continuous integration environment for the python > > code: get the latest

Re: Getting previous file name

2006-08-07 Thread Tim Williams
On 7 Aug 2006 13:52:16 -0700, Hitesh <[EMAIL PROTECTED]> wrote: > > I have a small script here that goes to inside dir and sorts the file > by create date. I can return the create date but I don't know how to > find the name of that file... > I need file that is not latest but was created before th

do people really complain about significant whitespace?

2006-08-07 Thread infidel
Where are they-who-hate-us-for-our-whitespace? Are "they" really that stupid/petty? Are "they" really out there at all? "They" almost sound like a mythical caste of tasteless heathens that "we" have invented. It just sounds like so much trivial nitpickery that it's hard to believe it's as common

Re: Python Projects Continuous Integration

2006-08-07 Thread Fuzzyman
Dave Potts wrote: > Hi, > > I'm just starting a development project in Python having spent time in > the Java world. I was wondering what tool advice you could give me > about setting up a continuous integration environment for the python > code: get the latest source, run all the tests, package

Re: Design Patterns in Python

2006-08-07 Thread Gabriel Genellina
At Saturday 5/8/2006 22:22, Alex Martelli wrote: > But does anyone know of a complete discussion/analysis of patterns in > Python? Books, articles, web pages... Thanks to all of you for your pointers on this subject! Gabriel Genellina Softlab SRL _

Re: format a number for output

2006-08-07 Thread BartlebyScrivener
Paul Rubin wrote: > "To iterate is human; to recurse, divine": > > def commafy(n): >if n < 0: return '-' + commafy(-n) >if n >= 1000: return '%s,%03d' % (commafy(n//1000), n % 1000) >return '%s'% n > > I don't like the locale solution because of how messy locales are.

Re: Getting previous file name

2006-08-07 Thread Larry Bates
Hitesh wrote: > Hi, > > I have a small script here that goes to inside dir and sorts the file > by create date. I can return the create date but I don't know how to > find the name of that file... > I need file that is not latest but was created before the last file. > Any hints... I am newbiw pyt

Getting previous file name

2006-08-07 Thread Hitesh
Hi, I have a small script here that goes to inside dir and sorts the file by create date. I can return the create date but I don't know how to find the name of that file... I need file that is not latest but was created before the last file. Any hints... I am newbiw python dude and still trying t

Re: format a number for output

2006-08-07 Thread Paul Rubin
"abcd" <[EMAIL PROTECTED]> writes: > 1890284 > > would be: > > 1,890,284 "To iterate is human; to recurse, divine": def commafy(n): if n < 0: return '-' + commafy(-n) if n >= 1000: return '%s,%03d' % (commafy(n//1000), n % 1000) return '%s'% n I don't like the locale s

distutils setup.py

2006-08-07 Thread Saketh
I'm having trouble getting the data_files argument of my setup.py to work with "python setup.py sdist" under Windows XP. Here is the data_files argument that I pass to setup(). data_files = [\ ('res','app.ico'), ('', 'preferences.xml'), ('res', glob.glob

Re: How to get hours and minutes from 'datetime.timedelta' object?

2006-08-07 Thread John Machin
Ant wrote: > John Machin wrote: > ... > > 1. If that's what he wanted, it was a very peculiar way of asking. Do > > you suspect that he needs to be shown how to conver 877.7... minutes > > into hours, minutes and seconds??? > > Chill dude, It wasn't an attack :-) I didn't think it was. > > The d

Re: where can I find Python acceptance test suite?

2006-08-07 Thread The Eternal Squire
Thanks. Terry Reedy wrote: > "The Eternal Squire" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > I've been doing some hacking of the Python engine, and I've been > > looking for > > where the comprehensive regression tests are kept so that I can > > determine > > where I've brok

Re: ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
All right I got it. Thank you anyway... create_date = os.stat(pathname)[ST_CTIME] print time.strftime("%Y%m%d", time.gmtime(create_date)) Hitesh wrote: > Hi, > > Any hint on converting time from ST_CTIME secs into mmdd format? > sorry for one-liner stupid question.. I couldn;t find (or rathe

ST_CTIME convert to yyyymmdd

2006-08-07 Thread Hitesh
Hi, Any hint on converting time from ST_CTIME secs into mmdd format? sorry for one-liner stupid question.. I couldn;t find (or rather figure out) in docs. Thank you, hj -- http://mail.python.org/mailman/listinfo/python-list

Re: Installing a Windows Printer

2006-08-07 Thread Jon
Hi D, I would suggest that you look here http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_7mgj.asp at AddPort and and AddPrinter. Though I have not tried to use them in python, I would assume that using win32com [http://www.python.net/crew/mhammond/win32/Downloads.html

Re: Initializing the number of slots in a dictionary

2006-08-07 Thread Fuzzyman
Jon Smirl wrote: > On Sun, 06 Aug 2006 15:33:30 -0700, John Machin wrote: [snip..] > > > > Do you have an application with a performance problem? If so, what makes > > you think inserting 1M items into a Python dict is contributing to the > > problem? > > I know in advance how many items will be a

Re: format a number for output

2006-08-07 Thread Yu-Xi Lim
Yu-Xi Lim wrote: > >>> b = 189028499 > >>> ','.join([str(b)[::-1][x:x+3] for x in range(len(str(b)))[::3]])[::-1] > > '-,189,028,499' Oops, mis-paste >>> b = -189028499 >>> ','.join([str(b)[::-1][x:x+3] for x in range(len(str(b)))[::3]])[::-1] -- http://mail.python.org/mailman/listinfo/pyt

Re: format a number for output

2006-08-07 Thread Yu-Xi Lim
Tim Williams wrote: a = 1890284 ','.join([str(a)[::-1][x:x+3] for x in range(len(str(a)))[::3]])[::-1] > '1,890,284' > > Ugly ! > >>> b = 189028499 >>> ','.join([str(b)[::-1][x:x+3] for x in range(len(str(b)))[::3]])[::-1] '-,189,028,499' >>> c = 1890284.1 >>> ','.join([str(c)[::

Re: Initializing the number of slots in a dictionary

2006-08-07 Thread Jon Smirl
On Mon, 07 Aug 2006 00:33:33 -0400, Tim Peters wrote: > ... > > [Jon Smirl] >> I know in advance how many items will be added to the dictionary. Most >> dictionary implementations I have previously worked with are more >> efficient if they know ahead of time how big to make their tables. > > Ric

Re: Resource temporarily unavailable launching idle under cygwin

2006-08-07 Thread jcmendez
PS: I already tried what suggested in a previous message on the groups "Python 2.3.2 spawn problem" - Uninstalling and reinstalling python without luck. Python 2.4.3 (#1, May 18 2006, 07:40:45) [GCC 3.3.3 (cygwin special)] on cygwin Thanks! jcmendez wrote: > Hello everyone. Trying to run idle

Installing a Windows Printer

2006-08-07 Thread D
I would like to create a script for Windows 2000 that will create a Standard TCP/IP printer port and install a printer (I have the applicable printer drivers needed for the install on a network share). My plan is to use py2exe and distribute (also via network share) the script so that administrator

Resource temporarily unavailable launching idle under cygwin

2006-08-07 Thread jcmendez
Hello everyone. Trying to run idle from a cygwin session on Win2k (yuk, but I must) I'm getting the following error message. It seems something more Windoze-driven that Python driven, and I'm not and don't wanna be an expert on that OS. Since the group has a good mix of users in different plat

Re: format a number for output

2006-08-07 Thread Tim Williams
On 7 Aug 2006 07:55:11 -0700, abcd <[EMAIL PROTECTED]> wrote: > if i have a number, say the size of a file, is there an easy way to > output it so that it includes commas? > > for example: > > 1890284 > > would be: > > 1,890,284 > I was bored !! >>> a = 1890284 >>> ','.join([str(a)[::-1][x:x+3] f

Re: Static Variables in Python?

2006-08-07 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Paddy <[EMAIL PROTECTED]> wrote: . [substantial thread with many serious alternatives] . . >You can do things with function attributes > >def foo(x

Re: Need a compelling argument to use Django instead of Rails

2006-08-07 Thread aaronwmail-usenet
Damjan wrote: > Yes, but your mod_python programs still run with the privileges of the > Apache process, as are all the other mod_python programs. This means that > my mod_python program can (at least) read files belonging to you - > including your config file holding your database password I

A problem from a Vim user

2006-08-07 Thread manuhack
When I use raw_input('Please type something.\n') in the python 2.4 command line windows, it doesn't have any problem. However, when I run the same command in vim 7 as :py raw_input('Please type something.\n'), there is an EOFError: EOF when reading a line. Is there a way to use that command withi

Re: Ann: SE 2.2b

2006-08-07 Thread Anthra Norell
If you go to http://www.python.org/pypi. you see it about in the middle of the recently updated packages. It's blue, so you can click it and you're there. The update page shows only the twenty most recent updates. So they drop out at the bottom rather fast. If it's gone by the time you chec

Re: format a number for output

2006-08-07 Thread BartlebyScrivener
abcd wrote: > if i have a number, say the size of a file, is there an easy way to > output it so that it includes commas? > > for example: > > 1890284 > > would be: > > 1,890,284 see also this thread: http://tinyurl.com/qf6ew rd -- http://mail.python.org/mailman/listinfo/python-list

Python 2.5b2 and excepthook problem

2006-08-07 Thread Larry Bates
I have some classes that trap hook sys.excepthook and log exceptions prior to the program exiting. This has proven to be an effective way to log what is going on with many of my "lights out" processes. I'm doing some testing with Python 2.5b2 and can't seem to get it to work properly. Here is a v

Re: need an alternative to getattr()

2006-08-07 Thread Jon Ribbens
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > import heading1 > import heading2 > While True: > heading = get_next_heading(file_ptr) # This func will return > "heading1", then "heading2"(on next call) > if heading = "": > break > getattr(heading, "process")(file_ptr

ANNOUNCE: Mod_python 3.2.10

2006-08-07 Thread Gregory (Grisha) Trubetskoy
The Apache Software Foundation and The Apache HTTP Server Project are pleased to announce the 3.2.10 release of mod_python. Mod_python 3.2.10 is considered a stable release, suitable for production use. Mod_python is an Apache HTTP Server module that embeds the Python language interpreter within

Re: need an alternative to getattr()

2006-08-07 Thread Ant
> getattr(heading, "process")(file_ptr) ... > Is there an alternatice to getattr() that will solve my problem, or is > there another way to do it. How about: eval("%s.process(%s)" % (heading, file_ptr)) -- http://mail.python.org/mailman/listinfo/python-list

Re: screensaver in Python

2006-08-07 Thread Ant
daniel Van der Borght wrote: > are you Chris ? anyway : thank you... No - I really am Ant. :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python open a named pipe == hanging?

2006-08-07 Thread Donn Cave
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Alex Martelli) wrote: > Donn Cave <[EMAIL PROTECTED]> wrote: > > > In article <[EMAIL PROTECTED]>, > > Rochester <[EMAIL PROTECTED]> wrote: > > > > > I just found out that the general open file mechanism doesn't work > > > for named

Re: screensaver in Python

2006-08-07 Thread daniel Van der Borght
are you Chris ? anyway : thank you... "Ant" <[EMAIL PROTECTED]> schreef in bericht news:[EMAIL PROTECTED] > > daniel Van der Borght wrote: >> Programming a screensaver in Python, where and/or how di I start ? > > Google for "python screensaver". The first link has a module to use... > -- http:

Re: need an alternative to getattr()

2006-08-07 Thread Uffe Wassmann
I think you would benefit from looking at the ConfigParser module. I haven't tried it yet, but it looks like a nice interface for writing and reading configuration files. -Uffe. On 7 Aug 2006 07:30:41 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, > > AIM: I have a config file that con

PyMorphic Project

2006-08-07 Thread Anders Österholm
As a part of my Master Thesis in Cognitive Science at the University of Linköping in Sweden i have created a Squeak-like system in Python called PyMorphic. Project homepage is http://pymorphic.sourceforge.net/ I am about to make a new release with minor changes.There is a tutorial for you in the To

Re: email client like mutt

2006-08-07 Thread cga2000
On Sun, Aug 06, 2006 at 04:15:08PM EDT, Aahz wrote: > In article <[EMAIL PROTECTED]>, > Fabian Braennstroem <[EMAIL PROTECTED]> wrote: > > > >I am looking for a python email client for the terminal... something like > >mutt; maybe, so powerfull ;-) > > What's wrong with mutt? Like he says it's n

Re: screensaver in Python

2006-08-07 Thread Ant
daniel Van der Borght wrote: > Programming a screensaver in Python, where and/or how di I start ? Google for "python screensaver". The first link has a module to use... -- http://mail.python.org/mailman/listinfo/python-list

screensaver in Python

2006-08-07 Thread daniel Van der Borght
Programming a screensaver in Python, where and/or how di I start ? Daniel VdB -- http://mail.python.org/mailman/listinfo/python-list

timeout calling local se

2006-08-07 Thread [EMAIL PROTECTED]
(Environment: RedHat Linux recent, Python 2.3.5) We have a batch processing script that on occasion needs to send out an email. We have a sendmail running locally. Sometimes we get a socket timeout on sending that email. Increasing the timeout to 30sec reduced but did not eliminate it. It seems

Re: format a number for output

2006-08-07 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, abcd wrote: > if i have a number, say the size of a file, is there an easy way to > output it so that it includes commas? > > for example: > > 1890284 > > would be: > > 1,890,284 I think this comes close: In [23]: import locale In [24]: locale.setlocale(locale.LC_ALL

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Martin Höfling
Thanks for your suggestions, precompiling is not an option, cause I can't introduce extra dependencies from a precompiler. > Better yet is to not write huge classes and getting rid of strange > conventions or views that make the problem appear as such. To explain that: > I've never felt the need

format a number for output

2006-08-07 Thread abcd
if i have a number, say the size of a file, is there an easy way to output it so that it includes commas? for example: 1890284 would be: 1,890,284 I am looking for something builtin to python, not a third party lib. thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ant
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. The editor leo (http://webpages.charter.net/edreamleo/front.html) gives you a way of handling large files in this way without actuall

need an alternative to getattr()

2006-08-07 Thread [EMAIL PROTECTED]
Hi, AIM: I have a config file that contains configuration under headings like this: heading1: heading2: ... ... i parse this file to get heading1, heading2, etc and then i want to call heading1.process(), heading2.process(), etc. What i am trying to do is: (this is not the exact code, it jus

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Bruno Desthuilliers
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. Technically, yes - but in a somewhat hackish way. But you *really* should not have such a need at first. Smells like a design (or co

Re: How to get hours and minutes from 'datetime.timedelta' object?

2006-08-07 Thread Ant
John Machin wrote: ... > 1. If that's what he wanted, it was a very peculiar way of asking. Do > you suspect that he needs to be shown how to conver 877.7... minutes > into hours, minutes and seconds??? Chill dude, It wasn't an attack :-) The datetime class has hour, minute and second attributes

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread Ziga Seilnacht
Martin Höfling wrote: > Hi there, > > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. > > Regards > Martin You could use something like this: """ Example usage: >>> class Person(object): ... def __init__(self

Re: is it possible to dividing up a class in multiple files?

2006-08-07 Thread bearophileHUGS
Martin Höfling: > is it possible to put the methods of a class in different files? I just > want to order them and try to keep the files small. Well, you can create one or more modules filled with nude methods, and you can define a class inside another module, and then add the methods to this last

Re: Nice unicode -> ascii translation?

2006-08-07 Thread skip
crowell> However, I'd like to see the more sensible "Bela Fleck" instead crowell> of dropping '\xe9' entirely. Assuming the data are in latin-1 or can be converted to it, try my latscii codec: http://orca.mojam.com/~skip/python/latscii.py Skip -- http://mail.python.org/mailman/li

  1   2   >