Re: naming objects from string

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 00:59, manstey wrote: If I have a string, how can I give that string name to a python object, such as a tuple. e.g. a = 'hello' b=(1234) and then a function name(b) = a which would mean: hello=(1234) is this possible? You may use another object as a namespace: class

Re: Is it possible to change a picture resolution with Python?

2006-09-21 Thread Lad
Tim Roberts wrote: > "Lad" <[EMAIL PROTECTED]> wrote: > > >from > >> image: > >> http://www.pythonware.com/library/pil/handbook/image.htm > >> > >> This is some example code: > >> > >> from PIL import Image > >> im = Image.open("1.jpg") > >> nx, ny = im.size > >> im2 = im.resize((int(nx*1.5), int(

Re: view page source or save after load

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 02:26, alex23 wrote: page = urllib.urlopen('http://some.address') add .read() at the end open('saved_page.txt','w').write(page).close() write() does not return the file object, so this won't work; you have to bind the file to a temporary variable to be able to close

Re: view page source or save after load

2006-09-21 Thread alex23
Gabriel Genellina wrote: Thanks for the corrections, Gabriel. I really need to learn to cut&paste working code :) Cheers. -alex23 -- http://mail.python.org/mailman/listinfo/python-list

Is it possible to save a running program and reload next time ?

2006-09-21 Thread [EMAIL PROTECTED]
Hi, I have a program which will continue to run for several days. When it is running, I can't do anything except waiting because it takes over most of the CUP time. Is it possible that the program can save all running data to a file when I want it to stop, and can reload the data and continue

Re: get process id...

2006-09-21 Thread billie
[EMAIL PROTECTED] ha scritto: > SpreadTooThin wrote: > > How does one get the process id? > > Is there a method for windows and unix (mac os x etc...) > > under linux, do: > import os > os.getpid() Under Windows: import ctypes ctypes.windll.kernel32.GetCurrentProcessId() -- http://mail.pyt

Re: new string method in 2.5 (partition)

2006-09-21 Thread Fredrik Lundh
Irmen de Jong wrote: > Because the result of partition is a non mutable tuple type containing > three substrings of the original string, is it perhaps also the case > that partition works without allocating extra memory for 3 new string > objects and copying the substrings into them? nope. the c

Re: get process id...

2006-09-21 Thread Tim Golden
billie wrote: > [EMAIL PROTECTED] ha scritto: > > > SpreadTooThin wrote: > > > How does one get the process id? > > > Is there a method for windows and unix (mac os x etc...) > > > > under linux, do: > > import os > > os.getpid() > > Under Windows: > import ctypes > ctypes.windll.kernel32.GetCu

Re: Do we need to delete "ImageDraw.Draw" after using it?

2006-09-21 Thread Fredrik Lundh
Steve Holden wrote: >> Is there any general rule that we must delete the object after using >> it? >> > Just consider it good hygiene. in this specific case, it may not be obvious for the casual reader that the global "draw" variable will contain an indirect reference to the original image obje

Re: get process id...

2006-09-21 Thread Fredrik Lundh
billie wrote: >> under linux, do: > >> import os >> os.getpid() > > Under Windows: > > import ctypes > ctypes.windll.kernel32.GetCurrentProcessId() getpid() works just fine on Windows too: >>> import ctypes >>> ctypes.windll.kernel32.GetCurrentProcessId() 1916 >>> import os >>> os.get

Re: naming objects from string

2006-09-21 Thread Fredrik Lundh
manstey wrote: > so they might provide a list of names, like 'bob','john','pete', with 3 > structures per name, such as 'apple','orange','red' and I need 9 tuples > in my code to store their data: > > bob_apple=() > bob_orange=() > .. > pete_red=() > > I then populate the 9 tuples with data they

Re: Request for elucidation: enhanced generators

2006-09-21 Thread Michele Simionato
Ben Sizer wrote: > But do you have an example of such a use case? Here is a 69 lines implementation of the idea of applying extended generators to manage Web forms (obviously this is only a proof of concept and it contains many mistakes, but you have something to get started). Notice that I am not

Re: Using py2exe to wrap a service?

2006-09-21 Thread MaR
Thanks guys! :o) It seems that no module is missing since the Service starts and the error message seem to indicate an error in the COM call to the AD. I would expect some other exception.. I do have a separate thread for the asyncore.loop() as I otherwise would risk a lockup. I do not call pyth

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Iain King
[EMAIL PROTECTED] wrote: > Hi, > > I have a program which will continue to run for several days. When it is > running, I can't do anything except waiting because it takes over most > of the CUP time. > > Is it possible that the program can save all running data to a file when > I want it to stop,

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread MonkeeSage
[EMAIL PROTECTED] wrote: > Is it possible that the program can save all running data to a file when > I want it to stop, and can reload the data and continue to run from > where it stops when the computer is free ? This isn't what you asked for (I have no idea how to do that), but given your descr

Evaluation of Truth Curiosity

2006-09-21 Thread James Stroud
Hello All, I'm curious, in py> 0 | (1 == 1) 1 py> False | (1 == 1) True What is the logic of the former expression not evaluating to True (or why the latter not 1?)? Is there some logic that necessitates the first operand's dictating the result of the evaluation? Or is this an artefact of the

Python and CORBA

2006-09-21 Thread rodmc
Can anyone recommend an easy to install COBRA implementation which works with Python? I am using Windows XP. Thanks in advance. Best, rod -- http://mail.python.org/mailman/listinfo/python-list

RE: Using py2exe to wrap a service?

2006-09-21 Thread Tim Golden
[MaR] | I do not call pythoncom.CoInitialize () as I tend to expect a module | wrapping COM stuff to do that. Hmmm. A slightly philosophical point. As the author of the said module, I think I'd have said that the other way round: I do not call CoInit... because I expect a user of the module *wh

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Jeremy Sanders
[EMAIL PROTECTED] wrote: > I have a program which will continue to run for several days. When it is > running, I can't do anything except waiting because it takes over most > of the CUP time. > > Is it possible that the program can save all running data to a file when > I want it to stop, and can

Re: naming objects from string

2006-09-21 Thread Jeremy Sanders
manstey wrote: > so they might provide a list of names, like 'bob','john','pete', with 3 > structures per name, such as 'apple','orange','red' and I need 9 tuples > in my code to store their data: > > bob_apple=() > bob_orange=() > .. > pete_red=() I really think you should be using dictionaries

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Roland.Csaszar
On 2006-09-21, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Is it possible that the program can save all running data to a file when > I want it to stop, and can reload the data and continue to run from > where it stops when the computer is free ? Well, on Irix you could use cpr

how to use timer in python

2006-09-21 Thread yxh
how to use timer in python. the functionnality is like the MFC SetTimer() -- http://mail.python.org/mailman/listinfo/python-list

Re: Evaluation of Truth Curiosity

2006-09-21 Thread MonkeeSage
James Stroud wrote: > What is the logic of the former expression not evaluating to True (or > why the latter not 1?)? Is there some logic that necessitates the first > operand's dictating the result of the evaluation? Or is this an artefact > of the CPython implementation? If I understand correctl

Re: how to use timer in python

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 06:03, yxh wrote: how to use timer in python. the functionnality is like the MFC SetTimer() Use the Timer class. Gabriel Genellina Softlab SRL __ Preguntá. Respondé. Descubrí. Todo lo

Re: Evaluation of Truth Curiosity

2006-09-21 Thread Fredrik Lundh
James Stroud wrote: > I'm curious, in > > py> 0 | (1 == 1) > 1 > py> False | (1 == 1) > True > > What is the logic of the former expression not evaluating to True (or > why the latter not 1?)? Is there some logic that necessitates the first > operand's dictating the result of the evaluation? O

Re: Evaluation of Truth Curiosity

2006-09-21 Thread Christophe
James Stroud a écrit : > Hello All, > > I'm curious, in > > py> 0 | (1 == 1) > 1 > py> False | (1 == 1) > True > > What is the logic of the former expression not evaluating to True (or > why the latter not 1?)? Is there some logic that necessitates the first > operand's dictating the result of

Re: Python and CORBA

2006-09-21 Thread Simon Brunning
On 21 Sep 2006 01:48:55 -0700, rodmc <[EMAIL PROTECTED]> wrote: > Can anyone recommend an easy to install COBRA implementation which > works with Python? I am using Windows XP. is the 2nd hit if you go to . ;-) -- Che

Re: Python Threading

2006-09-21 Thread Calvin Spealman
On 20 Sep 2006 00:27:07 -0700, daniel <[EMAIL PROTECTED]> wrote: > Hello, > Can anyone explain the main points in working with threads in Python. > Why use threading and not Thread.I have read an article that i have to > subclass the Thread class and override some function. I repeat this all the t

Re: Using py2exe to wrap a service?

2006-09-21 Thread MaR
Tim Golden wrote: > [MaR] > > | I do not call pythoncom.CoInitialize () as I tend to expect a module > | wrapping COM stuff to do that. > > Hmmm. A slightly philosophical point. [snip] :o) I agree! I have added the CoInit.. call to the __init__() of the threaded class (I understood the documenta

Re: Python Threading

2006-09-21 Thread Fredrik Lundh
Dennis Lee Bieber wrote: > ... slightly > simpler to use without subclassing (at the simplest level, you just pass > the function that is to be run, and a list of the arguments/parameters > it needs, to the threading creation class). that's exactly how thread.start_new_thread(func, args) works, o

RE: Using py2exe to wrap a service?

2006-09-21 Thread Tim Golden
[MaR] | Tim Golden wrote: | > [MaR] | > | > | I do not call pythoncom.CoInitialize () as I tend to | expect a module | > | wrapping COM stuff to do that. | > | > Hmmm. A slightly philosophical point. | [snip] | | :o) I agree! | | I have added the CoInit.. call to the __init__() of the threaded

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Duncan Booth
Jeremy Sanders <[EMAIL PROTECTED]> wrote: > For Linux (and other Unix like OSs), there are several "checkpointing" > libraries available which allow programs to be saved to disk, and > restarted later. > Another option which will work on just about anything would be to run the program in a vmwar

Can I inherit member variables?

2006-09-21 Thread lm401
I'm trying to work with the following idea: class animal: def __init__(self, weight, colour): self.weight = weight self.colour = colour class bird(animal): def __init__(self, wingspan): self.wingspan = wingspan print self.weight, self.colour, self.wingspan class fish(animal)

Re: Python and CORBA

2006-09-21 Thread Eric Brunel
On Thu, 21 Sep 2006 10:48:55 +0200, rodmc <[EMAIL PROTECTED]> wrote: > Can anyone recommend an easy to install COBRA implementation which > works with Python? I am using Windows XP. I used to use fnorb (http://sourceforge.net/projects/fnorb), but the project seems to be dead. It still seems t

Re: Can I inherit member variables?

2006-09-21 Thread Benjamin Niemann
Hello, [EMAIL PROTECTED] wrote: > I'm trying to work with the following idea: > > class animal: > def __init__(self, weight, colour): > self.weight = weight > self.colour = colour > > > class bird(animal): > def __init__(self, wingspan): > self.wingspan = wingspan > print s

Re: Evaluation of Truth Curiosity

2006-09-21 Thread James Stroud
Everyone wrote: > [something intelligent] Ah, clarity. My confusion can undoubtedly be traced to a non-existent formal training in computer programming. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I inherit member variables?

2006-09-21 Thread MonkeeSage
[EMAIL PROTECTED] wrote: > When I run my code from within the derived class, self.weight > and self.colour are not inherited (although methods are inherited as I > would have expected). Animal is never initialized and you're not passing weight and color into it anyway. You need something like:

Priority based concurrent execution

2006-09-21 Thread Willi Richert
Hi, I have a simulation application (PlayerStage) in which the robot is asked every ~200ms for an action. In the meantime the robot has to do some calculation with the perception. As the calculation gets more and more time consuming I am thinking about outsourcing it into a concurrently running

Re: view page source or save after load

2006-09-21 Thread James Stroud
Gabriel Genellina wrote: > At Thursday 21/9/2006 02:26, alex23 wrote: > >> page = urllib.urlopen('http://some.address') > > add .read() at the end > >> open('saved_page.txt','w').write(page).close() > > write() does not return the file object, so this won't work; you have to > bind the file to

Re: Can I inherit member variables?

2006-09-21 Thread LorcanM
Thanks for the reply. I think there's a basic misunderstanding about the nature of inheritance on my side. What I want to do is instantiate the sub class (derived class) from within the animal class. I then expect the sub class to have inherited some basic properties that it knows it has (weight,

Re: Can I inherit member variables?

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 06:52, [EMAIL PROTECTED] wrote: class animal: def __init__(self, weight, colour): self.weight = weight self.colour = colour class bird(animal): def __init__(self, wingspan): self.wingspan = wingspan print self.weight, self.colour, self.wingspan class

Re: Can I inherit member variables?

2006-09-21 Thread Gabriel Genellina
At Thursday 21/9/2006 07:34, LorcanM wrote: I think there's a basic misunderstanding about the nature of inheritance on my side. What I want to do is instantiate the sub class (derived class) from within the animal class. I then expect the sub class to have inherited some basic properties that

Re: Can I inherit member variables?

2006-09-21 Thread Benjamin Niemann
LorcanM wrote: > Benjamin Niemann wrote: > >> You'll have to invoke the __init__ method of the superclass, this is not >> done implicitly. And you probably want to add the weight and colour >> attributes to your subclass in order to pass these to the animal >> constructor. >> >> class fish(animal

Re: pexpect baudrate and mode settings

2006-09-21 Thread Ganesan Rajagopal
> Bryce Bolton <[EMAIL PROTECTED]> writes: > In short, setting of critical parameters is unclear under pexpect's > documentation, but may be obvious to those more familiar with os.open or > other filesystem internals. Try using "stty" program on Linux to set these parameters before you use pe

Re: Installing Python on a 64-Bit OS

2006-09-21 Thread Nico Grubert
> Several changes have been made to Python 2.4 and 2.5 to support > AMD64-Linux better, and not all of these changes have been > incorporated into Python 2.3, as this software is no longer > maintained. > As others have said: you should really try to use the python 2.4 > that comes with the operat

Re: get process id...

2006-09-21 Thread Chris
SpreadTooThin wrote: > How does one get the process id? > Is there a method for windows and unix (mac os x etc...) > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442477 hth -- http://mail.python.org/mailman/listinfo/python-list

Re: Python and CORBA

2006-09-21 Thread rodmc
Thanks to everyone for their help. I had tried OmniORB and while the base library worked ok, the Python bit OmniORBpy seems to dislike working... Perhaps there is something wrong with my settings. I will also try the Python only suggestion. cheers, rod -- http://mail.python.org/mailman/listinf

Re: naming objects from string

2006-09-21 Thread Terry Reedy
"James Stroud" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Depends on your namespace, but for the local namespace, you can use this: > > py> a = object() > py> a > > py> locals()['bob'] = a > py> bob > If you put this code within a function, it probably will not work. locals

Re: Can I inherit member variables?

2006-09-21 Thread MonkeeSage
Hi Lorcan, Mabye thinking of it like this will help: birds and fishes (I love that word, even if it is incorrect) can _do_ all the things that all animals have in common: eat, drink, die, reproduce, &c; but that is generic. class animal(object): def eat(self, food): pass ... class bird(animal

Re: Can I inherit member variables?

2006-09-21 Thread LorcanM
Thanks a lot folks for all the help. Its a lot clearer now. If I could summarise my original misunderstanding about inheritance: I belived that a sub class inherited a *specific instance* of the super class. This is clearly not right - the misunderstanding arose as I was instantiating the super

Re: ANN: Pocoo (bulletin board software) 0.1 beta released

2006-09-21 Thread robin
Georg Brandl <[EMAIL PROTECTED]> wrote: >The 0.1 release is not meant to be feature complete. It's more like a preview >to show off what's already there. If you like the idea, *feel free to join us!* Looks very nice so far. Will fill an important gap in Python apps. Oh, and you've been blogged: h

Re: Can I inherit member variables?

2006-09-21 Thread bearophileHUGS
MonkeeSage: If you have multiple inheritance do you need the old style init anyway? class Animal1(object): def __init__(self, weight, colour): self.weight = weight self.colour = colour class Animal2(object): def __init__(self, name): self.name = name class Bird(Animal1, Animal2)

Re: Can I inherit member variables?

2006-09-21 Thread MonkeeSage
[EMAIL PROTECTED] wrote: > If you have multiple inheritance do you need the old style init anyway? I guess so, I'm not really sure. This page talks about super() and MRO and such, but I have only glanced over it the other day. I will read it more fully sometime. I

Changing behaviour of namespaces

2006-09-21 Thread Mikael Olofsson
Hi! This is in Python 2.3.4 under WinXP. I have a situation where I think changing the behaviour of a namespace would be very nice. The goal is to be able to run a python file from another in a separate namespace in such a way that a NameError is not raised if a non-existing variable is used i

Re: Priority based concurrent execution

2006-09-21 Thread [EMAIL PROTECTED]
Willi Richert wrote: > Hi, > > I have a simulation application (PlayerStage) in which the robot is asked > every ~200ms for an action. In the meantime the robot has to do some > calculation with the perception. As the calculation gets more and more time > consuming I am thinking about outsourcing

Working with email and mailbox module

2006-09-21 Thread Nirnimesh
I want to extract emails from an mbox-type file which contains a number of individual emails. I tried the python mailbox and email modules individually, but I'm unable to combine them to get what I want. Mailbox allows me to iterate over all the mails but doesn't give me access the individual mess

mxCGIPython

2006-09-21 Thread Oleg Broytmann
Hello! For quite some time I was a maintainer of mxCGIPython. Now I am going to stop. There will no be mxCGIPython for Python 2.5. Python is quite popular these days, it is hard to find hosting without it. Original author abandoned mxCGIPython long ago, and I only provided some simple patches t

Re: Can I inherit member variables?

2006-09-21 Thread Bruno Desthuilliers
Gabriel Genellina wrote: (snip) > When you construct an object instance, it is of a certain type from that > precise moment, and you can't change that afterwards. Err... Actually, in Python, you can. It's even a no-brainer. (snip) -- bruno desthuilliers python -c "print '@'.join(['.'.join([w[::

Re: Using py2exe to wrap a service?

2006-09-21 Thread MaR
Tim Golden wrote: [snip..] > At this point there are several options open to us: > > (in no particular order) > 1) You could nudge the code at line 217 to make use of > that suggestion. > 2) I could do that and send you the result. > 3) I could alter the module so it doesn't use gencache > at all.

Re: text representation of HTML

2006-09-21 Thread Ksenia Marasanova
Sorry for the late reply... better too late than never :) Thanks to all for the tips. Stripogram is the winner, since it is the most configurable and accept line-length parameter, which is handy for email... Ksenia. On 7/19/06, Laurent Rahuel <[EMAIL PROTECTED]> wrote: > Hi, > > I guess stripogra

Re: naming objects from string

2006-09-21 Thread Roberto Bonvallet
manstey wrote: [...] > bob_apple=() > bob_orange=() > .. > pete_red=() > > I then populate the 9 tuples with data [...] You cannot "populate" a tuple. If you want to insert the values individually, you have to use a list. If you insert them all together, like this: bob_apple = (1, 2, ..., 9),

Re: Can I inherit member variables?

2006-09-21 Thread Bruno Desthuilliers
LorcanM wrote: (snip) > What I'm doing is a bit more > abstract: I'm instantiating a 'world' (as a super class) and then > various 'worldviews' as sub-classes. The 'worldviews' must know about > various aspects of the 'world' from which they are instantiated to be > able to do what they need to do

Re: Can I inherit member variables?

2006-09-21 Thread Wildemar Wildenburger
Bruno Desthuilliers wrote: > Gabriel Genellina wrote: >> When you construct an object instance, it is of a certain type from that >> precise moment, and you can't change that afterwards. > > Err... Actually, in Python, you can. It's even a no-brainer. Oh yeah, let's confuse the newbie, shall we :

Re: Changing behaviour of namespaces

2006-09-21 Thread Peter Otten
Mikael Olofsson wrote: > This is in Python 2.3.4 under WinXP. To feed an arbitrary mapping object to execfile() you need to upgrade to Python 2.4. http://docs.python.org/dev/lib/built-in-funcs.html#l2h-26 Peter -- http://mail.python.org/mailman/listinfo/python-list

Decorator cllass hides docstring from doctest?

2006-09-21 Thread Berthold Höllmann
Saving the following code to a file and running the code through python does not give the expected error. disableling the "@decor" line leads to the expected error message. Is this a bug or an overseen feature? --- snip dectest.py --- class decor(object): def __init__(self, f): self.f

Re: Priority based concurrent execution

2006-09-21 Thread Jean-Paul Calderone
On 21 Sep 2006 04:56:46 -0700, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Willi Richert wrote: >> Hi, >> >> I have a simulation application (PlayerStage) in which the robot is asked >> every ~200ms for an action. In the meantime the robot has to do some >> calculation with the perception. As

Re: Nested Looping SQL Querys

2006-09-21 Thread Carsten Haese
On Thu, 2006-09-21 at 01:12, Dennis Lee Bieber wrote: > On Wed, 20 Sep 2006 13:21:54 -0400, Steve Holden <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > .execute() is a cursor method, not a connection method. Some DB API > > modules do implement it as a connection method,

http://mail.python.org/pipermail/python-list/2006-January/320434.html

2006-09-21 Thread filippo randello
Hello, if after your command: ie.Document.login_form.submit() I write: doc = ie.Document s = doc.documentElement.outerHTML print s I can see the HTML of the document before the submit command, but I would like to see the HTML of the page after the submit command: do you know how to solve this p

Re: Python and CORBA

2006-09-21 Thread Diez B. Roggisch
rodmc wrote: > Thanks to everyone for their help. I had tried OmniORB and while the > base library worked ok, the Python bit OmniORBpy seems to dislike > working... Perhaps there is something wrong with my settings. Omniorb is very actively developed, try and post your problems on the mailing lis

Re: Decorator cllass hides docstring from doctest?

2006-09-21 Thread Duncan Booth
[EMAIL PROTECTED] (Berthold =?iso-8859-15?Q?H=F6llmann?=) wrote: > Saving the following code to a file and running the code through > python does not give the expected error. disableling the "@decor" line > leads to the expected error message. Is this a bug or an overseen > feature? > It's a prob

Re: Decorator cllass hides docstring from doctest?

2006-09-21 Thread Felipe Almeida Lessa
2006/9/21, Berthold Höllmann <[EMAIL PROTECTED]>: > Saving the following code to a file and running the code through > python does not give the expected error. disableling the "@decor" line > leads to the expected error message. Is this a bug or an overseen > feature? Try the new_decor class descr

How to get ip setting, dynamic ip or static ip?

2006-09-21 Thread kode4u
How to use python get my windows box's ip setting type? Dynamic ip, or static ip? If it's static ip, what's the exact value? -- http://mail.python.org/mailman/listinfo/python-list

Re: Trying to run an external program

2006-09-21 Thread Larry Bates
Brant Sears wrote: > Hi. I'm new to Python and I am trying to use the latest release (2.5) on > Windows XP. > > What I want to do is execute a program and have the results of the > execution assigned to a variable. According to the documentation the way > to do this is as follows: > > import comm

Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Mikael Olofsson
Peter Otten wrote: > To feed an arbitrary mapping object to execfile() you need to upgrade to > Python 2.4. Thanks! As clear as possible. I will do that. FYI: I think I managed to achieve what I want in Py2.3 using the compiler module: def getNamesFromAstNode(node,varSet): if node._

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread [EMAIL PROTECTED]
Dennis Lee Bieber wrote: > On Thu, 21 Sep 2006 15:34:21 +0800, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >> Is it possible that the program can save all running data to a file when >> I want it to stop, and can reload the data and continue to run

Re: Can I inherit member variables?

2006-09-21 Thread MonkeeSage
Ps. Aristotle can rest easy tonight: class mortal(object): pass class man(mortal): pass Socrates = man() all_men = mortal() if Socrates == all_men: print "Socrates == all_man" else: print "Undistributed Middle is indeed a fallacy" ;) Regards, Jordan -- http://mail.python.org/mailman/listi

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Larry Bates
[EMAIL PROTECTED] wrote: > Hi, > > I have a program which will continue to run for several days. When it is > running, I can't do anything except waiting because it takes over most > of the CUP time. > > Is it possible that the program can save all running data to a file when > I want it to stop,

Re: Decorator cllass hides docstring from doctest?

2006-09-21 Thread Michele Simionato
Berthold Höllmann wrote: > Saving the following code to a file and running the code through > python does not give the expected error. disableling the "@decor" line > leads to the expected error message. Is this a bug or an overseen > feature? Others have already pointed out the mistake. I wrote a

Python 2.5 WinXP AMD64

2006-09-21 Thread Brendan
Hello, I just tried to use the Windows XP installer for Python 2.5 AMD64 but I get the error message: "Installation package not supported by processor type" I am running Windows XP Pro on an AMD Athon 64 Processor. Do I need to have a 64-bit OS to use this version? -- http://mail.python.org/mai

Re: Python and CORBA

2006-09-21 Thread Paul McGuire
"rodmc" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thanks to everyone for their help. I had tried OmniORB and while the > base library worked ok, the Python bit OmniORBpy seems to dislike > working... Perhaps there is something wrong with my settings. > > I will also try the Pyt

Re: Decorator cllass hides docstring from doctest?

2006-09-21 Thread Peter Otten
Berthold Höllmann wrote: > Saving the following code to a file and running the code through > python does not give the expected error. disableling the "@decor" line > leads to the expected error message. Is this a bug or an overseen > feature? Neither, I'd say. Just an unfortunate interaction bet

Re: How to get ip setting, dynamic ip or static ip?

2006-09-21 Thread Duncan Booth
"kode4u" <[EMAIL PROTECTED]> wrote: > How to use python get my windows box's ip setting type? Dynamic ip, or > static ip? > > If it's static ip, what's the exact value? > Here's one way: def ipinfo(interface="Local Area Connection"): dhcpenabled = False staticip = None s

Tk eventloop

2006-09-21 Thread swell
Hi I try/struggle to use an ActiveX component in a Tk app. When i execute it i can catch the first event and then when i try to change the value of the w widget everything blocks and nothing is updated anymore. Does someone have an idea of what is wrong and how to smartly integrate these events wi

How to return an "not string' error in function?

2006-09-21 Thread breakfastea
first of all I have to claim that I'm a noob so please help me don't blame me:) for example: def test(s): if type(s) != ? : return #So here I want establish a situation about that if is not string #then , but how should write the ? #Or is there any other way to do it? Any sugg

Re: Python 2.5 WinXP AMD64

2006-09-21 Thread Christophe
Brendan a écrit : > Hello, > I just tried to use the Windows XP installer for Python 2.5 AMD64 but I > get the error message: "Installation package not supported by processor > type" > > I am running Windows XP Pro on an AMD Athon 64 Processor. > > Do I need to have a 64-bit OS to use this versio

Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Peter Otten
Mikael Olofsson wrote: > Peter Otten wrote: >> To feed an arbitrary mapping object to execfile() you need to upgrade to >> Python 2.4. > > Thanks! As clear as possible. I will do that. > > FYI: I think I managed to achieve what I want in Py2.3 using the > compiler module: > > def getNamesFr

Re: How to return an "not string' error in function?

2006-09-21 Thread Tim Chase
> def test(s): >if type(s) != ? : > return > #So here I want establish a situation about that if is not string > #then , but how should write the ? > #Or is there any other way to do it? >>> isinstance("hello", basestring) True >>> isinstance(u"hello", basestring) True This

Re: Python 2.5 WinXP AMD64

2006-09-21 Thread Brendan
Thanks. Christophe wrote: > Brendan a écrit : > > Hello, > > I just tried to use the Windows XP installer for Python 2.5 AMD64 but I > > get the error message: "Installation package not supported by processor > > type" > > > > I am running Windows XP Pro on an AMD Athon 64 Processor. > > > > Do I

Re: How to return an "not string' error in function?

2006-09-21 Thread Jean-Paul Calderone
On Thu, 21 Sep 2006 09:26:20 -0500, Tim Chase <[EMAIL PROTECTED]> wrote: >> def test(s): >>if type(s) != ? : >> return >> #So here I want establish a situation about that if is not string >> #then , but how should write the ? >> #Or is there any other way to do it? > > >>> isins

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Thank you so much it answers my humble question perfectly:) -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it possible to save a running program and reload next time ?

2006-09-21 Thread Hans Georg Krauthaeuser
[EMAIL PROTECTED] wrote: > > Can objects be saved and reloaded by "Pickle" ? I have tried but no > success. > Yes, that's the intended use of pickle/cPickle. There are examples in the docs: http://docs.python.org/lib/module-pickle.html What have you tried and what didn't work? Hans Georg --

itertools.count(-3)

2006-09-21 Thread bearophileHUGS
itertools.count docs say: Does not currently support python long integers. Note, count() does not check for overflow and will return negative numbers after exceeding sys.maxint. This behavior may change in the future. But it seems it doesn't support negative numbers too: >>> from itertools import

Re: Using Beautiful Soup to entangle bookmarks.html

2006-09-21 Thread robin
"George Sakkis" <[EMAIL PROTECTED]> wrote: >Here's what I came up with: >http://rafb.net/paste/results/G91EAo70.html. Tested only on my >bookmarks; see if it works for you. That URL is dead. Got another? - robin noisetheatre.blogspot.com -- http://mail.python.org/mailman/listinfo/python-lis

Re: How to return an "not string' error in function?

2006-09-21 Thread Duncan Booth
Tim Chase <[EMAIL PROTECTED]> wrote: > This will return true for both regular strings and for unicode > strings. If that's a problem, you can use > > >>> import types > >>> isinstance("hello", types.StringType) > True > >>> isinstance(u"hello", types.StringType) > False > >>> isinstance("hello"

Re: Changing behaviour of namespaces - solved, I think

2006-09-21 Thread Mikael Olofsson
Peter Otten wrote: > Clearly more elegant than: > > print open(filename).read() > b = a > dummy = 42 names = [] while 1: > ... ns = dict((n, dummy) for n in names) > ... try: > ... execfile(filename, ns) > ... except Name

Re: get process id...

2006-09-21 Thread billie
Fredrik Lundh ha scritto: > billie wrote: > > >> under linux, do: > > > >> import os > >> os.getpid() > > > > Under Windows: > > > > import ctypes > > ctypes.windll.kernel32.GetCurrentProcessId() > > getpid() works just fine on Windows too: > > >>> import ctypes > >>> ctypes.windll.kernel

Re: itertools.count(-3)

2006-09-21 Thread Carl Banks
[EMAIL PROTECTED] wrote: > itertools.count docs say: > Does not currently support python long integers. > Note, count() does not check for overflow and will return negative > numbers after exceeding sys.maxint. This behavior may change in the > future. > > But it seems it doesn't support negative

Re: How to return an "not string' error in function?

2006-09-21 Thread breakfastea
Or yes that seems a handy way:) Thanks for all wonderful people here:) Peace Duncan Booth wrote: > Tim Chase <[EMAIL PROTECTED]> wrote: > > > This will return true for both regular strings and for unicode > > strings. If that's a problem, you can use > > > > >>> import types > > >>> isinstance

Re: Python 2.5 WinXP AMD64

2006-09-21 Thread Bjoern Schliessmann
Christophe wrote: > To be exact, you need a 64bit Windows OS on a 64bit cpu. Is there a reason that can be explained in a less-than-2-KB posting? :) I mean why Python depends on the processor type that much. Regards, Björn -- BOFH excuse #52: Smell from unhygienic janitorial staff wrecked t

Re: How to return an "not string' error in function?

2006-09-21 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> wrote: >Thank you so much it answers my humble question perfectly:) > HOWEVER, to answer you final question, yes, there is a different and, in general, better, way. While there's a lot to say about good Python style and typing, I'll summarize a

  1   2   >