Re: Overwrite only one function with property()

2006-11-18 Thread gagsl-py
On 18 nov, 19:06, "Kai Kuehne" <[EMAIL PROTECTED]> wrote:

> It is possible to overwrite only one function with the property-function?
>
> x = property(getx, setx, delx, 'doc')
>
> I just want to overwrite setx, but when I set the others to None,
> I can't read and del the member. Any ideas or is this not possible?

Do you want to override the setter of an existing property, in a
derived class?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedded python adding variables linking to C++-Variables / callbacks

2006-12-07 Thread gagsl-py
iwl ha escrito:

> I would like to add Variables to my embedded python which represents
> variables from my
> C++-Programm.
> I found C-Api-funcs for adding my C-Funcs to python but none to add
> variables.
> I would like some C-Function is called when the added Python-varible is
> set (LValue) and
> some other when it is read (RValue). Can I do this.
> May be I have to do this in python and call the C-Funcs from a python
> callback.

Write some C functions -callable from Python- which will be used to get
and set the variable value.
>From inside Python, declare a property with getter and setter which
will call your C functions.
This works fine for object attributes. If you want to trap references
to local or global "variables", I think you could provide customized
dictionaries for locals and globals, but I'm not sure if it works
really.

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Embedded python adding variables linking to C++-Variables / callbacks

2006-12-07 Thread gagsl-py
On 7 dic, 11:33, "iwl" <[EMAIL PROTECTED]> wrote:

> What I found out up to now is to create a class inherited from an
> fitting type
> and overwrite the __setitem__ and __getitem__ method but haven't test
> this
> yet, something like that:
>
> class test(int):
>  __setitem(self, value)__:  C-Set-Func(value)
>  __getitem(self)__: return C-Get-Func()
>
> x=test()
> x= -> C-Set-Func called
> y=x -> C-Get-Func called

Python doesn't work that way: http://effbot.org/zone/python-objects.htm

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Multithreaded python script calls the COMMAND LINE

2006-12-07 Thread gagsl-py
On 7 dic, 17:36, "johnny" <[EMAIL PROTECTED]> wrote:
> I have python script does ftp download in a multi threaded way. Each
> thread downloads a file, close the file, calls the comman line to
> convert the .doc to pdf. Command line should go ahead and convert the
> file. My question is, when each thread calls the command line, does one
> command line process all the request, or each thread creates a one
> command line process for themselves and executes the command? For some
> reason I am getting "File '1' is alread exists, Do you want to
> overwrite [y/n]?" I have to manually enter 'y' or 'n' for the python
> script to complete.

That depends on how you invoke it: os.system creates a new shell which
in turn creates a new process; the spawn* functions do that directly.
Anyway, if you have many conversion processes running, you should pass
them unique file names to avoid conflicts.
Where does the '1' name come from? If it's you, don't use a fixed name
- the tempfile module may be useful.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: SOAP Server with WSDL?

2006-12-07 Thread gagsl-py
On 7 dic, 18:52, tobiah <[EMAIL PROTECTED]> wrote:

> Actually, do I have to make a WSDL?  Do people hand write these, or
> are there tools?  I don't really need to publish an interface.  I just
> want some in house apps to communicate.
>
> I can't figure out if I want SOAP, or CORBA, or would it just be
> easier if I just starting opening sockets and firing data around
> directly.  Ideally, I'd like to share complex objects.  That's why
> I thought that I needed one of the above standards.

A few alternatives:

xml-rpc
Pros: multiplatform, multilanguage, standard, available in python std
lib, very simple to use
Cons: simple function calls only, limited argument types, no objects as
argument

Pyro 
Pros: object based, multiplatform, full python language support
(argument list, keyword arguments...)
Cons: only Python supported, non standard

CORBA is a big beast and if you don't actually need it, don't use it...

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: write an update manager in python/wxPython

2006-12-07 Thread gagsl-py
On 7 dic, 19:04, Will McGugan <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I have a small application for which I would like to write an update
> > manager. I assume that the basics of it is to compare versions of the
> > user's current application and a new one store in a new file on a
> > particular URL.
> Dont think there is a standard way of doing it. The way I have done it
> in my applications is to keep an ini file containing the version number,
>   which is downloaded and compared against the version of the app. That
> part is trivial to implement in python with urllib. I just point the
> user at the download url when there is a new version. It would require a
> little more effort if you want to have some kind of automatic update...

There is a sample script (in tools/versioncheck in your Python
directory) you could use as a starting point. Not a big deal...

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list