Re: dictionary that discards old items

2005-07-24 Thread Bengt Richter
On Sat, 23 Jul 2005 20:07:25 -0600, Steven Bethard [EMAIL PROTECTED] wrote: [Raymond Hettinger] class Cache(dict): def __init__(self, n, *args, **kwds): self.n = n self.queue = collections.deque() dict.__init__(self, *args, **kwds) [Bengt Richter] Minor comment: There is

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Michael Hoffman
Peter Hansen wrote: Point taken. What about ditching the file part, since it is redundant and obvious that a file is in fact what is being accessed. Thus: .read_bytes(), .read_text(), .write_lines() etc. +1. Although I've always been somewhat -0 on these methods to start with. -- Michael

Re: Getting a dictionary from an object

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 01:43:43PM +1000, Steven D'Aprano wrote: On Sun, 24 Jul 2005 02:09:54 +0300, Thanos Tsouanas wrote: print foo %do where do is a dictobj object... Are you telling me that the ONLY thing you use dictobj objects for is to print them? I'm sorry to disappoint

Re: Getting a dictionary from an object

2005-07-24 Thread Thanos Tsouanas
On Sat, Jul 23, 2005 at 06:59:43PM -0600, Steven Bethard wrote: Thanos Tsouanas wrote: I would like to have a quick way to create dicts from object, so that a call to foo['bar'] would return obj.bar. The following works, but I would prefer to use a built-in way if one exists. Is there

How to run python script in background after i logout

2005-07-24 Thread Harlin Seritt
I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It runs fine. When I log off ssh I notice that the script died when I logged off. How do I make sure it stays running? thanks, Harlin Seritt

Re: How to run python script in background after i logout

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 02:43:44AM -0700, Harlin Seritt wrote: I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It runs fine. When I log off ssh I notice that the script died when I

Re: How to run python script in background after i logout

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 12:51:17PM +0300, Thanos Tsouanas wrote: On Sun, Jul 24, 2005 at 02:43:44AM -0700, Harlin Seritt wrote: I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It

ANN: MyNewspaper 1.2

2005-07-24 Thread Iñigo Serna
Hi there, I'm really pleased to announce the second public release of MyNewspaper. MyNewspaper v1.2: faster (25-35%), cleaner (100%), smaller(69%) and even more robust(100%). If you liked the first version but thought... uhmm it's buggy and slow, then this is your release. In fact first

Re: dictionary that discards old items

2005-07-24 Thread Raymond Hettinger
[Raymond Hettinger] class Cache(dict): def __init__(self, n, *args, **kwds): self.n = n self.queue = collections.deque() dict.__init__(self, *args, **kwds) [Bengt Richter] Minor comment: There is a potential name collision problem for keyword n=something, so

Re: How do i do this

2005-07-24 Thread Diez B.Roggisch
Amit Regmi amitregmi at neolinuxsolutions.com writes: For some commad Linux like (pdbedit) its not possible to supply password in the command line itself while we add a samba user account into the You might be able to utilize pexpect for this. Go google :) Diez --

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Francois De Serres wrote: hiho, what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to the string 'spam'? TIA, Francois thanks to all! I'll pick ('%c' * len(t)) % t, for it's readability and the fact that join() is on the deprec'd list. Francois --

Initializing interactive Python

2005-07-24 Thread qwweeeit
Hi all, is it possible to enter an interactive session and automatically do some initialization? I explain better: I want that when I start interactive Python on a console (I use Linux) two command lines be executed automatically: Python 2.3.4 (#2, Aug 19 2004, 15:49:40) [GCC 3.4.1 (Mandrakelinux

Re: PostgreSQL Python vs PHP

2005-07-24 Thread Bruno Desthuilliers
Luis P. Mendes a écrit : (snip) I need to build it from the server and also client side. For the client side I'll be using Python. But for the server side, I would like to hear some opinions. Is it worth learning Php? I dont think so - unless you have no other choice !-) More

Re: Initializing interactive Python

2005-07-24 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Hi all, is it possible to enter an interactive session and automatically do some initialization? I explain better: I want that when I start interactive Python on a console (I use Linux) two command lines be executed automatically: [EMAIL PROTECTED] bruno $ python

Re: Initializing interactive Python

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 03:26:06AM -0700, [EMAIL PROTECTED] wrote: Hi all, is it possible to enter an interactive session and automatically do some initialization? set the enviroment variable PYTHONSTARTUP to point to a startup.py of your own, where you put all your initializations.. HTH --

FAQ?

2005-07-24 Thread Keith P. Boruff
Hello, Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Thanks, KPB -- http://mail.python.org/mailman/listinfo/python-list

Re: tuple to string?

2005-07-24 Thread John Machin
Steven D'Aprano wrote: On Sat, 23 Jul 2005 23:26:19 +1000, John Machin wrote: Steven D'Aprano wrote: ''.join(map(lambda n: chr(n), (0x73, 0x70, 0x61, 0x6D))) 'spam' Why the verbal diarrhoea? One line is hardly verbal diarrhoea. What's wrong with the (already posted)

Re: How to run python script in background after i logout

2005-07-24 Thread Benji York
Harlin Seritt wrote: python script.py It runs fine. When I log off ssh I notice that the script died when I logged off. How do I make sure it stays running? As another reply stated, cron is probably what you really want, but to answer your question literally: you want the nohup command

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Thanos Tsouanas a écrit : On Sun, Jul 24, 2005 at 01:43:43PM +1000, Steven D'Aprano wrote: (snip) Why jump through all those hoops to get attributes when Python already provides indexing and attribute grabbing machinery that work well? Why do you bother to subclass dict, only to mangle the

Re: Getting a dictionary from an object

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 02:01:30PM +0200, Bruno Desthuilliers wrote: Thanos Tsouanas a écrit : On Sun, Jul 24, 2005 at 01:43:43PM +1000, Steven D'Aprano wrote: Because *obviously* I don't know of these indexing and attribute grabbing machineries you are talking about in my case. If you

Re: tuple to string?

2005-07-24 Thread John Machin
Steven D'Aprano wrote: On Sat, 23 Jul 2005 23:31:04 +1000, John Machin wrote: You don't need the sissy parentheses; '%c' * len(t) % t works just fine :-) Ah, ok. Didn't want to lookup the precedence rules... Look up the precedence rules? Are you aware of any language where * / and %

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Bruno Desthuilliers a écrit : (snip) class Wrapper(object): def __init__(self, obj): self._obj = obj def __getitem__(self, name): return getattr(self._obj, name) If you want the Wrapper to be more like a Decorator (ie still can use the Wrapper object as if it was the

Re: How can I get an sha1 hash in base32?

2005-07-24 Thread Elmo Mäntynen
On Sat, 23 Jul 2005 23:27:44 +0200, Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Elmo Mäntynen wrote: I know how to make a hash(using mhash), but instead of encoded as hex I want it in base32 for use with the bitzi catalog. python-bitzi is useful but way too slow for just getting

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Sun, 24 Jul 2005 02:09:54 +0300, Thanos Tsouanas wrote: (snip) Are you telling me that the ONLY thing you use dictobj objects for is to print them? I don't think so. I do know how to print an object, amazingly. Perhaps you would like to explain how you

Re: Initializing interactive Python

2005-07-24 Thread qwweeeit
Hi Bruno, thank you...Easy as pie !-) Bye. -- http://mail.python.org/mailman/listinfo/python-list

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Peter Hansen wrote: Reinhold Birkenfeld wrote: [on comparing Paths and stings] Do you have a use case for the comparison? Paths should be compared only with other paths. I can think of lots, though I don't know that I've used any in my existing (somewhat limited) code that uses Path, but

Re: tuple to string?

2005-07-24 Thread John Machin
Francois De Serres wrote: Francois De Serres wrote: hiho, what's the clean way to translate the tuple (0x73, 0x70, 0x61, 0x6D) to the string 'spam'? TIA, Francois thanks to all! I'll pick ('%c' * len(t)) % t, for it's readability and the fact that join() is on the deprec'd

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Reinhold Birkenfeld wrote: Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. Further changes by now: * subdirs() is now dirs(). * fixed compare behaviour for unicode base (unicode has no rich compare) * __iter__()

Re: Getting a dictionary from an object

2005-07-24 Thread Thanos Tsouanas
On Sun, Jul 24, 2005 at 03:01:40PM +0200, Bruno Desthuilliers wrote: I gave you a solution based on the Decorator pattern in another post, but there is also the possibility to add a __getitem__ method directly to the to-be-formatted object's class: def mygetitem(obj, name): return

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
I've used pygtk with success on windows. (...) [will] I be able to make an executable (using Py2Exe) of an application that uses PyGTK? Yes. So PyGTK is now my favourite. Better documentation, runs on Linux and Windows, the possibility to make an executable program with Py2Exe. It's enough

Re: FAQ?

2005-07-24 Thread Michael Hoffman
Keith P. Boruff wrote: Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Try Google for python FAQ. I don't know why you would want to look in a FAQ *specific* to a newsgroup to look up slicing questions, since

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
PyQt works equally well on both systems. I believe you. The problem is I don't like GPL. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread TPJ
Thanks a lot! Now I know I can choose PyGTK. I really like it because of its rich documentation. You could also bundle the runtime DLLs with your py2exe'd application That's great. I think my clients will appreciate a single one executable. --

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Michael Hoffman
Reinhold Birkenfeld wrote: * __iter__() iterates over the parts(). * the following methods raise NotImplemented: capitalize, expandtabs, join, splitlines, title, zfill Why? They *are* implemented. I do not understand this desire to wantonly break basestring compatiblity for the sake of

Re: Getting a dictionary from an object

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 12:03:47 +0300, Thanos Tsouanas wrote: On Sun, Jul 24, 2005 at 01:43:43PM +1000, Steven D'Aprano wrote: On Sun, 24 Jul 2005 02:09:54 +0300, Thanos Tsouanas wrote: print foo %do where do is a dictobj object... Are you telling me that the ONLY thing you use

Re: Friend wants to learn python

2005-07-24 Thread TPJ
Why not start with Python's standard documentation? There are Python Tutorial and Library Reference. IMHO it's the best place to start. -- http://mail.python.org/mailman/listinfo/python-list

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Ivan Van Laningham
Hi All-- Reinhold Birkenfeld wrote: Reinhold Birkenfeld wrote: Hi, the arguments in the previous thread were convincing enough, so I made the Path class inherit from str/unicode again. Thanks. * the following methods raise NotImplemented: capitalize, expandtabs, join,

Re: FAQ?

2005-07-24 Thread Keith P. Boruff
Michael Hoffman wrote: Keith P. Boruff wrote: Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Try Google for python FAQ. I tried and didn't find one. That's why I asked here. I don't know why you would want

Re: FAQ?

2005-07-24 Thread gene tani
Here's my trove of FAQ/Gotcha lists http://www.ferg.org/projects/python_gotchas.html http://zephyrfalcon.org/labs/python_pitfalls.html http://zephyrfalcon.org/labs/beginners_mistakes.html http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html http://www.norvig.com/python-iaq.html

Re: FAQ?

2005-07-24 Thread Keith P. Boruff
gene tani wrote: Here's my trove of FAQ/Gotcha lists http://www.ferg.org/projects/python_gotchas.html http://zephyrfalcon.org/labs/python_pitfalls.html http://zephyrfalcon.org/labs/beginners_mistakes.html http://www.onlamp.com/pub/a/python/2004/02/05/learn_python.html

Re: Getting a dictionary from an object

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 12:07:02 +0300, Thanos Tsouanas wrote: On Sat, Jul 23, 2005 at 06:59:43PM -0600, Steven Bethard wrote: Thanos Tsouanas wrote: I would like to have a quick way to create dicts from object, so that a call to foo['bar'] would return obj.bar. The following works, but I

Re: FAQ?

2005-07-24 Thread rafi
Keith P. Boruff wrote: Michael Hoffman wrote: Keith P. Boruff wrote: Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Try Google for python FAQ. I tried and didn't find one. That's why I asked here.

Re: How to realize ssh scp in Python

2005-07-24 Thread Jeff Epler
Rather than doing anything with passwords, you should instead use public key authentication. This involves creating a keypair with ssh_keygen, putting the private key on the machine opening the ssh connection (~/.ssh/id_rsa), then listing the public key in the remote system's

Re: Aliasing an object's __str__ to a different method

2005-07-24 Thread Jeffrey E. Forcier
On Jul 24, 2005, at 5:00 AM, Bengt Richter wrote: Actually, it's not just the magic methods. [...] Thanks for the clarification/explanation =) This looks a little strange because the repr of the bound method includes a repr of the thing bound to, which returns the Edit/View presentation

Re: FAQ?

2005-07-24 Thread Michael Hoffman
Keith P. Boruff wrote: Michael Hoffman wrote: Keith P. Boruff wrote: Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Try Google for python FAQ. I tried and didn't find one. That's why I asked here. When I

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Marek Kubica
Hello! AFAIK PyGTK doesn't look native on Win as well, but I don't care. It does have a nearly-native look and feel: http://gtk-wimp.sourceforge.net/screenshots/ And yes, the theme adjusts itself to Windows XP themes, so GTK+ apps look nearly like any other Windows Program. The native look and

Re: How to realize ssh scp by Python

2005-07-24 Thread Jesse Noller
On 7/23/05, 刚 王 [EMAIL PROTECTED] wrote: I would like to write a Python code like this: It can login a host by SSH after login the host, use SCP to get a remote file, so it can deliver file to the host. then execute the program then leave the host For example : STEP 1. ssh _yyy

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Michael Hoffman wrote: Reinhold Birkenfeld wrote: * __iter__() iterates over the parts(). * the following methods raise NotImplemented: capitalize, expandtabs, join, splitlines, title, zfill Why? They *are* implemented. I do not understand this desire to wantonly break basestring

Re: FAQ?

2005-07-24 Thread tiissa
Michael Hoffman wrote: Keith P. Boruff wrote: Michael Hoffman wrote: Keith P. Boruff wrote: Is there an FAQ available specific to this NG as I'm sure some of the list slicing questions I have have been asked before. Therefore I asked a question on why you want a *newsgroup* FAQ when

Re: tuple to string?

2005-07-24 Thread Robert Kern
Francois De Serres wrote: I'll pick ('%c' * len(t)) % t, for it's readability and the fact that join() is on the deprec'd list. ''.join() is certainly not deprecated. What made you think that? -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Sun, 24 Jul 2005 12:03:47 +0300, Thanos Tsouanas wrote: Please, tell me, how would you print it in my case? If I have understood you, you have some object like such: obj.foo = 1 obj.bar = 2 obj.spam = 'a' obj.eggs = 'b' say. You want to use it

ANN: Veusz 0.7 - a scientific plotting package

2005-07-24 Thread Jeremy Sanders
Veusz 0.7 - Velvet Ember Under Sky Zenith - http://home.gna.org/veusz/ Veusz is a scientific plotting package written in Python (currently 100% Python). It uses PyQt for display and user-interfaces, and numarray for handling the numeric data. Veusz is designed

Re: tuple to string?

2005-07-24 Thread Francois De Serres
Robert Kern wrote: Francois De Serres wrote: I'll pick ('%c' * len(t)) % t, for it's readability and the fact that join() is on the deprec'd list. ''.join() is certainly not deprecated. What made you think that? this: http://www.python.org/doc/2.4.1/lib/node110.html but I now

Importing User-defined Modules

2005-07-24 Thread Walter Brunswick
I need to import modules with user-defined file extensions that differ from '.py', and also (if possible) redirect the bytecode output of the file to a file of a user-defined extension. I've already read PEP 302 (http://www.python.org/peps/pep-0302.html), but I didn't fully understand it. Would

Re: tuple to string?

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 21:55:19 +1000, John Machin wrote: Look up the precedence rules? Are you aware of any language where * / and % _don't_ have the same precedence?? Do languages like Pascal that don't have string formatting expressions, or use the % operator, count? A thousand pardons;

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Peter Hansen
Reinhold Birkenfeld wrote: Peter Hansen wrote: if mypath.splitpath()[0] == 'c:/temp': vs. if mypath.splitpath()[0] == Path('c:/temp'): But you must admit that that't the cleaner solution. Cleaner? Not at all. I'd say it's the more expressive solution, perhaps, but I definitely

Re: tuple to string?

2005-07-24 Thread Robert Kern
John Machin wrote: No precedence rules - no relevance to the topic Precedence rules of other languages - no relevance to the topic -- Robert Kern [EMAIL PROTECTED] In the fields of hell where the grass grows high Are the graves of dreams allowed to die. -- Richard Harter --

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Torsten Bronger
Hallöchen! Marek Kubica [EMAIL PROTECTED] writes: Hello! AFAIK PyGTK doesn't look native on Win as well, but I don't care. [...] The native look and feel is not as good as the look and feel of wx but still really _much_ better than older versions of GTK. Is PyGTK more Pythonic by the way?

Re: tuple to string?

2005-07-24 Thread Steven D'Aprano
On Sun, 24 Jul 2005 10:39:44 -0700, Robert Kern wrote: John Machin wrote: No precedence rules - no relevance to the topic Precedence rules of other languages - no relevance to the topic I thought the topic was -- or at least had wandered in the direction of -- whether or not it was

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Mike Meyer
Steven D'Aprano [EMAIL PROTECTED] writes: On Sat, 23 Jul 2005 17:51:31 -0600, John Roth wrote: I also like to know the number of elements, which seems to make sense as len(path). Again, the number of characters in the path seems to be utterly useless information - at least, I can't imagine a

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Sun, 24 Jul 2005 12:07:02 +0300, Thanos Tsouanas wrote: Thanos Tsouanas wrote: (snip) I didn't know about it, but I knew about object.__dict__ which is, as I see equivalent with vars(object). But it doesn't do the job for me, since it fails to grab all obj.foo's,

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 23:35 +0200, Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Soeren Sonnenburg wrote: Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead extend/join an array: a=[1,2,3] b=[4,5,6]

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: Hi all, Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead extend/join an array: * and

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 20:25 -0700, Dan Bishop wrote: Soeren Sonnenburg wrote: Hi all, Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead extend/join an array: a=[1,2,3] b=[4,5,6] a+b [1, 2, 3, 4, 5,

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Soeren Sonnenburg
On Sat, 2005-07-23 at 12:15 -0700, Robert Kern wrote: Soeren Sonnenburg wrote: Hi all, Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead extend/join an array: a=[1,2,3] This isn't an array. It is a

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Robert Kern
Soeren Sonnenburg wrote: On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: Hi all, Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead extend/join an

Re: tuple to string?

2005-07-24 Thread Peter Hansen
Steven D'Aprano wrote: Still, the subject is rapidly losing whatever interest it may have had. It had none. Kill it. Kill the witch! -- http://mail.python.org/mailman/listinfo/python-list

Try this

2005-07-24 Thread RunLevelZero
I'm not sure I understand your first question but checkout the glob module. Sounds like it may help. Here is how you could get the folders and filenames import os list = os.walk(C:\python24\Tools) for file in list: folderlist = os.path.split(file[0]) print

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Marek Kubica
Hi! Am Sun, 24 Jul 2005 19:47:30 +0200 schrieb Torsten Bronger: Is PyGTK more Pythonic by the way? I had a look at wxPython yesterday and didn't like that it has been brought into the Python world nearly unchanged. You can see its non-Python origin clearly. How does PyGTK feel in this

Re: Detecting computers on network

2005-07-24 Thread Marek Kubica
Hello! On Fri, 22 Jul 2005 10:32:04 -0600 Sandeep Arya wrote: Sybren.. Does nmap is available on every systems? I tried on my linux fc4 machine in user previleage. it was not working. Does this just belongs to superuser... I'm not Sybren, but I think I'm able to respond. nmap is only

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Reinhold Birkenfeld
Peter Hansen wrote: Reinhold Birkenfeld wrote: Peter Hansen wrote: if mypath.splitpath()[0] == 'c:/temp': vs. if mypath.splitpath()[0] == Path('c:/temp'): But you must admit that that't the cleaner solution. Cleaner? Not at all. I'd say it's the more expressive solution,

Re: Friend wants to learn python

2005-07-24 Thread Marek Kubica
Hello, On 23 Jul 2005 10:24:02 -0700 Pietro Campesato wrote: Maybe diveintopython.org can help I consider diveintopython a little bit to hard for the beginner. I really like this book, it's excellent, great thanks to Mike Pilgrim for providing us the book. I pointed a friend to Python

Re: How to run python script in background after i logout

2005-07-24 Thread Mike Meyer
Thanos Tsouanas [EMAIL PROTECTED] writes: On Sun, Jul 24, 2005 at 12:51:17PM +0300, Thanos Tsouanas wrote: On Sun, Jul 24, 2005 at 02:43:44AM -0700, Harlin Seritt wrote: I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I

Re: How to run python script in background after i logout

2005-07-24 Thread Steve M
Harlin Seritt wrote: I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It runs fine. When I log off ssh I notice that the script died when I logged off. How do I make sure it stays running?

Re: How to run python script in background after i logout

2005-07-24 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24 Jul 2005, Harlin Seritt wrote: I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It runs fine. When I log off ssh I notice that the

Re: How to run python script in background after i logout

2005-07-24 Thread Marek Kubica
Hello! On 24 Jul 2005 12:59:04 -0700 Steve M wrote: Another is that when I use putty.exe from Windows for my ssh client, I can't get scroll-back buffers to work correctly with screen. (Screen is really powerful with its own scrollback buffers and screendumps and stuff but I don't have time

Re: Getting a dictionary from an object

2005-07-24 Thread Steven Bethard
Thanos Tsouanas wrote: Steven Bethard wrote: Maybe I'm not understanding your problem, but have you looked at the builtin vars()? I didn't know about it, but I knew about object.__dict__ which is, as I see equivalent with vars(object). But it doesn't do the job for me, since it fails to

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Torsten Bronger
Hallöchen! Marek Kubica [EMAIL PROTECTED] writes: [...] I have started GUIs in Python with wx, but after a short time I was annoyed how many things were buggy. I don't know why, but I fell from one bug to the other while programming one application. I'm very suprised. wxPython is still

Re: Try this

2005-07-24 Thread Michael Hoffman
RunLevelZero wrote: I'm not sure I understand your first question but checkout the glob module. Sounds like it may help. Who are you talking to? It would help if you quoted text from the original message, left some of the original subject, and replied to the original message instead of

Re: Initializing interactive Python

2005-07-24 Thread Tomasz Rola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 24 Jul 2005 [EMAIL PROTECTED] wrote: Hi all, is it possible to enter an interactive session and automatically do some initialization? I explain better: I want that when I start interactive Python on a console (I use Linux) two command lines

Re: Getting a dictionary from an object

2005-07-24 Thread Bruno Desthuilliers
*Grandmaster* Steven Bethard a écrit : How about something like: dict((name, getattr(obj, name)) for name in dir(obj)) ... voiceless-ly'rs -- http://mail.python.org/mailman/listinfo/python-list

Re: How to run python script in background after i logout

2005-07-24 Thread James David
Harlin Seritt [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py It runs fine. When I log off ssh I notice that the script died when

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Carl Banks
Soeren Sonnenburg wrote: On Sun, 2005-07-24 at 13:36 +1000, Steven D'Aprano wrote: On Sat, 23 Jul 2005 18:30:02 +0200, Soeren Sonnenburg wrote: Hi all, Just having started with python, I feel that simple array operations '*' and '+' don't do multiplication/addition but instead

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Michael Hoffman
Reinhold Birkenfeld wrote: I'm in no way the last instance on this. For example, everyone with CVS access is free to change the files ;) I don't have CVS write access :(, so I'll have to keep kibitzing for now. Honestly, I'm in constant fear that allowing too much and loading too much

Re: [path-PEP] Path inherits from basestring again

2005-07-24 Thread Andrew Dalke
Reinhold Birkenfeld wrote: Okay. While a path has its clear use cases and those don't need above methods, it may be that some brain-dead functions needs them. brain-dead? Consider this code, which I think is not atypical. import sys def _read_file(filename): if filename == -: # Can use

Getting the --options of configure on installed python

2005-07-24 Thread Thanos Tsouanas
Hello! Is there a way to get the --options with which python was configured on a system? Thanks in advance. -- Thanos Tsouanas .: My Music: http://www.thanostsouanas.com/ http://thanos.sians.org/ .: Sians Music: http://www.sians.org/ --

Re: Path inherits from basestring again

2005-07-24 Thread Carl Banks
Reinhold Birkenfeld wrote: Peter Hansen wrote: Reinhold Birkenfeld wrote: One thing is still different, though: a Path instance won't compare to a regular string. Could you please expand on what this means? Are you referring to doing and = type operations on Paths and strings, or

Re: consistency: extending arrays vs. multiplication ?

2005-07-24 Thread Christopher Subich
Soeren Sonnenburg wrote: On Sat, 2005-07-23 at 23:35 +0200, Marc 'BlackJack' Rintsch wrote: Both operate on the lists themselves and not on their contents. Quite consistent if you ask me. But why ?? Why not have them operate on content, like is done on *arrays ? Because they're lists, not

Re: Getting the --options of configure on installed python

2005-07-24 Thread gene tani
look in distutils.cfg: http://www.python.org/doc/2.4.1/inst/config-syntax.html for modules compiled in, sys.builtin_module_names -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Bryan
Torsten Bronger wrote: Besides, wxPython prepares for being included into the standard distribution. wow, i've never heard this said so explicitly. is there a reference link backing up this statement? i really really hope this is true. i'm very much in favor to see wx included in the

Re: return None

2005-07-24 Thread Repton
geon wrote: Ximo wrote: Can I do a function which don't return anything? Nothing is None, or isnt? A woodman was carrying a sack full of chopped wood on his back. His sack was heavy and filled beyond its limit. The man, bent under his bulky burden, was struggling not to drop any of the wood

Simple Problem

2005-07-24 Thread ncf
I know I've seen this somewhere before, but does anyone know what the function to escape a string is? (i.e., encoding newline to \n and a chr(254) to \xfe) (and visa-versa) Thanks for helping my ignorance :P -Wes -- http://mail.python.org/mailman/listinfo/python-list

Re: PyGTK or wxPython (not a flame war) on Windows

2005-07-24 Thread Peter Decker
On 7/24/05, Torsten Bronger [EMAIL PROTECTED] wrote: Is PyGTK more Pythonic by the way? I had a look at wxPython yesterday and didn't like that it has been brought into the Python world nearly unchanged. You can see its non-Python origin clearly. How does PyGTK feel in this respect? There

Re: Simple Problem

2005-07-24 Thread Cyril Bazin
By any chance are you speaking about the function repr ? Cyril On 24 Jul 2005 18:14:13 -0700, ncf [EMAIL PROTECTED] wrote: I know I've seen this somewhere before, but does anyone know what thefunction to escape a string is? (i.e., encoding newline to \n and achr(254) to \xfe) (and

Re: Simple Problem

2005-07-24 Thread Paul Rubin
ncf [EMAIL PROTECTED] writes: I know I've seen this somewhere before, but does anyone know what the function to escape a string is? (i.e., encoding newline to \n and a chr(254) to \xfe) (and visa-versa) repr(s) -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple Problem

2005-07-24 Thread Robert Kern
ncf wrote: I know I've seen this somewhere before, but does anyone know what the function to escape a string is? (i.e., encoding newline to \n and a chr(254) to \xfe) (and visa-versa) In [1]: s = foo\n\xfe In [2]: s.encode(string_escape) Out[2]: 'foo\\n\\xfe' In [3]: repr(s)[1:-1] Out[3]:

Re: Simple Problem

2005-07-24 Thread Jp Calderone
On 24 Jul 2005 18:14:13 -0700, ncf [EMAIL PROTECTED] wrote: I know I've seen this somewhere before, but does anyone know what the function to escape a string is? (i.e., encoding newline to \n and a chr(254) to \xfe) (and visa-versa) Thanks for helping my ignorance :P Python 2.4.1 (#2, Mar 30

Re: Simple Problem

2005-07-24 Thread ncf
Thank you all for your replies. The repr() solution wasn't exactly what I was looking for, as I wasn't planning on eval()ing it, but the (en|de)code solution was exactly what I was looking for. An extended thanks to Jp for informing me of the version compatibility :) Have a GREAT day :) -Wes --

Re: return None

2005-07-24 Thread Christopher Subich
Repton wrote: 'Well, there's your payment.' said the Hodja. 'Take it and go!' +1: the koan of None Upon hearing that, the man was enlightened. -- http://mail.python.org/mailman/listinfo/python-list

Re: what's wrong with my code using subprocess?

2005-07-24 Thread Tim Lesher
I see the same behavior as you do. On Windows, the wait() isn't hanging--what's happening is that the subprocess just never receives anything. I don't quite understand why, but it works fine when I change the if clause in receiver.py to this: if count = 1000: p.communicate('exit')

  1   2   >